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


C# HttpRequestMessage.AsFormattedString方法代码示例

本文整理汇总了C#中System.Net.Http.HttpRequestMessage.AsFormattedString方法的典型用法代码示例。如果您正苦于以下问题:C# HttpRequestMessage.AsFormattedString方法的具体用法?C# HttpRequestMessage.AsFormattedString怎么用?C# HttpRequestMessage.AsFormattedString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Net.Http.HttpRequestMessage的用法示例。


在下文中一共展示了HttpRequestMessage.AsFormattedString方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HttpRequestMessageAsFormattedStringHandlesEmptyRequests

 public void HttpRequestMessageAsFormattedStringHandlesEmptyRequests()
 {
     using (var httpRequest = new HttpRequestMessage())
     {
         var formattedString = httpRequest.AsFormattedString();
         Assert.Contains("Method: GET", formattedString);
     }
 }
开发者ID:Ranjana1996,项目名称:autorest,代码行数:8,代码来源:CloudTracingExtensionsTest.cs

示例2: LogsRequest

 public void LogsRequest()
 {
     Log4NetTracingInterceptor logger = new Log4NetTracingInterceptor("app.config");
     string invocationId = "12345";
     HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "http://azuresdk.com");
     string expected = string.Format("DEBUG - invocationId: {0}\r\nrequest: {1}\r\n", invocationId,
         request.AsFormattedString());
     logger.SendRequest(invocationId, request);
     string actual = File.ReadAllText(logFileName);
     Assert.Equal(expected, actual);
 }
开发者ID:Ranjana1996,项目名称:autorest,代码行数:11,代码来源:Log4NetTracingInterceptorTest.cs

示例3: HttpRequestMessageAsFormattedStringHandlesRequestsWithContent

 public void HttpRequestMessageAsFormattedStringHandlesRequestsWithContent()
 {
     using (var httpRequest = new HttpRequestMessage(HttpMethod.Get, "http://www.windowsazure.com/test"))
     {
         httpRequest.Content = new StringContent("<body/>");
         var formattedString = httpRequest.AsFormattedString();
         Assert.Contains("Method: GET", formattedString);
         Assert.Contains("RequestUri: 'http://www.windowsazure.com/test'", formattedString);
         Assert.Contains("<body/>", formattedString);
     }
 }
开发者ID:Ranjana1996,项目名称:autorest,代码行数:11,代码来源:CloudTracingExtensionsTest.cs

示例4: HttpRequestMessageAsFormattedStringHandlesRequestsWithHeaders

 public void HttpRequestMessageAsFormattedStringHandlesRequestsWithHeaders()
 {
     using (var httpRequest = new HttpRequestMessage(HttpMethod.Get, "http://www.windowsazure.com/test"))
     {
         httpRequest.Headers.Add("x-ms-version", "2013-11-01");
         var formattedString = httpRequest.AsFormattedString();
         Assert.Contains("Method: GET", formattedString);
         Assert.Contains("RequestUri: 'http://www.windowsazure.com/test'", formattedString);
         Assert.Contains("x-ms-version: 2013-11-01", formattedString);
     }
 }
开发者ID:Ranjana1996,项目名称:autorest,代码行数:11,代码来源:CloudTracingExtensionsTest.cs

示例5: SendRequest

 public void SendRequest(string invocationId, HttpRequestMessage request)
 {
     _logger.LogInformation("    request: {0}", request.AsFormattedString());
 }
开发者ID:jhancock93,项目名称:autorest,代码行数:4,代码来源:TestTracingInterceptor.cs

示例6: SendRequest

        /// <summary>
        /// Send an HTTP request.
        /// </summary>
        /// <param name="invocationId">Method invocation identifier.</param>
        /// <param name="request">The request about to be sent.</param>
        public virtual void SendRequest(string invocationId, HttpRequestMessage request)
        {
            string requestAsString = request == null ? string.Empty : request.AsFormattedString();

            HttpOperationEventSource.Log.SendRequest(invocationId, requestAsString);
        }
开发者ID:Ranjana1996,项目名称:autorest,代码行数:11,代码来源:EtwTracingInterceptor.cs

示例7: SendRequest

 /// <summary>
 /// Send an HTTP request.
 /// </summary>
 /// <param name="invocationId">Method invocation identifier.</param>
 /// <param name="request">The request about to be sent.</param>
 public void SendRequest(string invocationId, HttpRequestMessage request)
 {
     string requestAsString = (request == null ? string.Empty : request.AsFormattedString());
     _logger.DebugFormat(CultureInfo.InvariantCulture,
         "invocationId: {0}\r\nrequest: {1}", invocationId, requestAsString);
 }
开发者ID:Ranjana1996,项目名称:autorest,代码行数:11,代码来源:Log4NetTracingInterceptor.cs

示例8: SendRequest

 /// <summary>
 /// Send an HTTP request.
 /// </summary>
 /// <param name="invocationId">Method invocation identifier.</param>
 /// <param name="request">The request about to be sent.</param>
 public void SendRequest(string invocationId, HttpRequestMessage request)
 {
     string requestAsString = request == null ? string.Empty : request.AsFormattedString();
     _logger.DebugFormat("invocationId: {0}\r\nrequest: {1}", invocationId, requestAsString);
 }
开发者ID:ApplicationGateway,项目名称:azure-sdk-for-net,代码行数:10,代码来源:Log4NetTracingInterceptor.cs


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