当前位置: 首页>>代码示例>>C#>>正文


C# RequestContext.Prepare方法代码示例

本文整理汇总了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"]);
 }
开发者ID:karlseguin,项目名称:mashape-dotnet-client-library,代码行数:7,代码来源:Prepare.cs

示例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);
      }
 }
开发者ID:karlseguin,项目名称:mashape-dotnet-client-library,代码行数:9,代码来源:Prepare.cs

示例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());
      }
 }
开发者ID:karlseguin,项目名称:mashape-dotnet-client-library,代码行数:9,代码来源:Prepare.cs

示例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());
      }
 }
开发者ID:karlseguin,项目名称:mashape-dotnet-client-library,代码行数:9,代码来源:Prepare.cs

示例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);
      }
 }
开发者ID:karlseguin,项目名称:mashape-dotnet-client-library,代码行数:11,代码来源:Prepare.cs

示例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);
      }
 }
开发者ID:karlseguin,项目名称:mashape-dotnet-client-library,代码行数:11,代码来源:Prepare.cs

示例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"]);
 }
开发者ID:karlseguin,项目名称:mashape-dotnet-client-library,代码行数:7,代码来源:Prepare.cs


注:本文中的RequestContext.Prepare方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。