本文整理汇总了C#中QueryBuilder.BaseUri方法的典型用法代码示例。如果您正苦于以下问题:C# QueryBuilder.BaseUri方法的具体用法?C# QueryBuilder.BaseUri怎么用?C# QueryBuilder.BaseUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryBuilder
的用法示例。
在下文中一共展示了QueryBuilder.BaseUri方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HeaderSingleValue
public void HeaderSingleValue()
{
var request = new FluentRequest();
var builder = new QueryBuilder(request);
builder.BaseUri("http://test.com/");
builder.Header("Test", "Test");
Assert.True(builder.Request.Headers.ContainsKey("Test"));
Assert.True(builder.Request.Headers["Test"].First() == "Test");
}
示例2: QueryStringNull
public void QueryStringNull()
{
var request = new FluentRequest();
var builder = new QueryBuilder(request);
string value = null;
builder.BaseUri("http://test.com/");
builder.QueryString("Test", value);
var uri = request.RequestUri();
Assert.Equal("http://test.com/?Test=", uri.ToString());
}
示例3: QueryStringMultipleValue
public void QueryStringMultipleValue()
{
var request = new FluentRequest();
var builder = new QueryBuilder(request);
builder.BaseUri("http://test.com/");
builder.QueryString("Test", "Test1");
builder.QueryString("Test", "Test2");
var uri = request.RequestUri();
Assert.Equal("http://test.com/?Test=Test1&Test=Test2", uri.ToString());
}
示例4: HeaderNullValue
public void HeaderNullValue()
{
var request = new FluentRequest();
var builder = new QueryBuilder(request);
string value = null;
builder.BaseUri("http://test.com/");
builder.Header("Test", "Test");
Assert.True(builder.Request.Headers.ContainsKey("Test"));
builder.Header("Test", value);
Assert.False(builder.Request.Headers.ContainsKey("Test"));
}
示例5: AppendPathWithTrailingSlash
public void AppendPathWithTrailingSlash()
{
var request = new FluentRequest();
var builder = new QueryBuilder(request);
builder.BaseUri("http://test.com/api/").AppendPath("v1");
var url = request.RequestUri();
Assert.Equal("http://test.com/api/v1", url.ToString());
}
示例6: RequestUriInvalidUri
public void RequestUriInvalidUri()
{
var request = new FluentRequest();
var builder = new QueryBuilder(request);
var baseUri = new Uri("/api", UriKind.Relative);
Assert.Throws<UriFormatException>(() =>
{
builder.BaseUri(baseUri).AppendPath("v1");
var uri = request.RequestUri();
});
}
示例7: RequestUriInvalid
public void RequestUriInvalid()
{
var request = new FluentRequest();
var builder = new QueryBuilder(request);
Assert.Throws<UriFormatException>(() => builder.BaseUri("/api/").AppendPath("v1"));
}