本文整理汇总了C#中RequestContext.Prepare方法的典型用法代码示例。如果您正苦于以下问题:C# RequestContext.Prepare方法的具体用法?C# RequestContext.Prepare怎么用?C# RequestContext.Prepare使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RequestContext
的用法示例。
在下文中一共展示了RequestContext.Prepare方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetsMetaHeaders
public void SetsMetaHeaders()
{
var request = new RequestContext(HttpMethods.Get, Enumerable.Empty<KeyValuePair<string, object>>());
request.Prepare();
Assert.AreEqual("dotnet", request.Request.Headers["X-Mashape-Language"]);
Assert.AreEqual("0.1", request.Request.Headers["X-Mashape-Version"]);
}
示例2: SetsTheProperMethod
public void SetsTheProperMethod()
{
foreach (var method in AllMethods)
{
var request = new RequestContext(method, Enumerable.Empty<KeyValuePair<string, object>>());
request.Prepare();
Assert.AreEqual(method.ToString().ToUpper(), request.Request.Method);
}
}
示例3: QueryMethodsIncludeTheQueryInTheUrl
public void QueryMethodsIncludeTheQueryInTheUrl()
{
foreach (var method in QueryMethods)
{
var request = new RequestContext(method, new Dictionary<string, object> { { "itsover", 9000 } });
request.Prepare();
Assert.AreEqual("http://localhost:9948/api.spice?itsover=9000", request.Request.RequestUri.ToString());
}
}
示例4: BodyMethodsDoNotIncludeTheQueryInTheUrl
public void BodyMethodsDoNotIncludeTheQueryInTheUrl()
{
foreach (var method in BodyMethods)
{
var request = new RequestContext(method, new Dictionary<string, object> { { "name", "duncan" } });
request.Prepare();
Assert.AreEqual("http://localhost:9948/api.spice", request.Request.RequestUri.ToString());
}
}
示例5: QueryMethodsDoesNotPrepareABody
public void QueryMethodsDoesNotPrepareABody()
{
foreach(var method in QueryMethods)
{
var request = new RequestContext(method, Enumerable.Empty<KeyValuePair<string, object>>());
request.Prepare();
Assert.AreEqual(null, request.Request.ContentType);
Assert.AreEqual(-1, request.Request.ContentLength);
Assert.AreEqual(null, request.PayloadData);
}
}
示例6: PutPostAndDeletePrepareABody
public void PutPostAndDeletePrepareABody()
{
foreach (var method in BodyMethods)
{
var request = new RequestContext(method, new Dictionary<string, object>{{"leto", "spice"}});
request.Prepare();
Assert.AreEqual("application/x-www-form-urlencoded", request.Request.ContentType);
Assert.AreEqual(10, request.Request.ContentLength);
Assert.AreEqual(new byte[] { 108, 101, 116, 111, 61, 115, 112, 105, 99, 101 }, request.PayloadData);
}
}
示例7: SignsTheRequestUsingTheConfiguredKeys
public void SignsTheRequestUsingTheConfiguredKeys()
{
Driver.Configure("pu", "pi");
var request = new RequestContext(HttpMethods.Get, Enumerable.Empty<KeyValuePair<string, object>>());
request.Prepare();
Assert.AreEqual("cHU6NTVhMzcyNzRhNzU3YTU3YmE0NDZjMDcyMmU2ODhlNWFlNGJiMGUxZTVlZWUzOWYxLWMwOTYtNDY5My04NDBhLWI2MWQ3ZDIzMjFhZg==", request.Request.Headers["X-Mashape-Authorization"]);
}