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


C# Http.HttpResponseMessage类代码示例

本文整理汇总了C#中Microsoft.Http.HttpResponseMessage的典型用法代码示例。如果您正苦于以下问题:C# HttpResponseMessage类的具体用法?C# HttpResponseMessage怎么用?C# HttpResponseMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


HttpResponseMessage类属于Microsoft.Http命名空间,在下文中一共展示了HttpResponseMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NewRestfulieProxy

 private RestfulieProxy NewRestfulieProxy(HttpResponseMessage httpResponseMessage)
 {
     return new RestfulieProxy(_httpClient, _dynamicContentParserFactory, _httpMethodDiscoverer)
     {
         LatestHttpResponseMessage = httpResponseMessage,
         DynamicContentParser = _dynamicContentParserFactory.New(httpResponseMessage.Content)
     };
 }
开发者ID:sharpshooting,项目名称:restfulie-csharp,代码行数:8,代码来源:Restfulie.cs

示例2: ProcessRequestAndTryGetResponse

            protected override void ProcessRequestAndTryGetResponse(HttpRequestMessage request, out HttpResponseMessage response, out object state)
            {
                response = _httpResponseMessage;

                response.Request = request;
                response.Method = request.Method;

                state = _state;
            }
开发者ID:sharpshooting,项目名称:restfulie-csharp,代码行数:9,代码来源:HttpClientFake.cs

示例3: LogResponse

 public static void LogResponse(this IDnaLogger logger,HttpStatusCode httpStatusCode, HttpResponseMessage httpResponse)
 {
     var props = new Dictionary<string, object>() 
     { 
         { "Result", httpStatusCode.ToString()},
         { "Uri", httpResponse.Uri.ToString()},
         { "Content", httpResponse.Content.ReadAsString()}
     };
     string category = Assembly.GetCallingAssembly().GetName().Name + ".Responses";
     logger.LogGeneral(TraceEventType.Information, category, "", DateTime.MaxValue, props);
 }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:11,代码来源:LogUtility.cs

示例4: SetUp

        public void SetUp()
        {
            MockedHttpClientAdapter = new Mock<IHttpClientAdapter>();
            MockedHttpClient = new Mock<IHttpClient>();
            MockedConfigSettings = new Mock<IConfigSettings>();

            PackageAuthenticator = new Infrastructure.Impl.PackageAuthenticator(MockedHttpClientAdapter.Object, MockedConfigSettings.Object,
                new Mock<ILogger>().Object);

            OkHttpResponse = new HttpResponseMessage { StatusCode = HttpStatusCode.OK, Content = HttpContent.Create("true") };
        }
开发者ID:dioptre,项目名称:nkd,代码行数:11,代码来源:PackageTesterBase.cs

示例5: ShouldProvideHttpStatusCodeUponRecievingResponse

        public void ShouldProvideHttpStatusCodeUponRecievingResponse()
        {
            var httpResponseMessage = new HttpResponseMessage { StatusCode = HttpStatusCode.OK };

            dynamic resource = new RestfulieProxy(It.IsAny<IHttpClient>(), It.IsAny<IDynamicContentParserFactory>(), It.IsAny<IHttpMethodDiscoverer>())
            {
                LatestHttpResponseMessage = httpResponseMessage
            };

            Assert.AreEqual("200", resource.StatusCode);
        }
开发者ID:sharpshooting,项目名称:restfulie-csharp,代码行数:11,代码来源:RestfulieProxyTests.cs

示例6: FaultFor

 private static Fault FaultFor(HttpResponseMessage response)
 {
     Fault fault;
     try
     {
         fault = response.Content.ReadAsDataContract<Fault>();
     }
     catch (Exception)
     {
         fault = new Fault() {Message = response.StatusCode.ToString()};
     }
     return fault;
 }
开发者ID:RaoulHolzer,项目名称:EnergyTrading-MDM-Sample,代码行数:13,代码来源:HttpResponseExtensions.cs

示例7: ToNativeResponse

 private static DataPackets.HttpResponseMessage ToNativeResponse(HttpResponseMessage response)
 {
     var responseFormat = new DataPackets.HttpResponseMessage
     {
         Content =
         {
             Content = Zip.GetUnzippedContent(response),
             ContentType = response.Content.ContentType,
             Encoding = GetEncoding(response.Content.ContentType)
         },
         Method = response.Method,
         Properties = response.Properties,
         StatusCode = response.StatusCode,
         Uri = response.Uri
     };
     return responseFormat;
 }
开发者ID:RJacksonm1,项目名称:JustGiving.Api.Sdk,代码行数:17,代码来源:HttpClientWrapper.cs

示例8: AssertHttpResponse

        public static void AssertHttpResponse(HttpResponseMessage response,string methodName)
        {
            bool succeed = false;

            if (response.StatusCode == HttpStatusCode.OK)
            {
                succeed = true;
                TextLog.LogMessage(methodName + ": Test Case Pass.");
                Console.WriteLine(methodName + ": Get Response successfully.");
            }
            else
            {
                succeed = false;
                TextLog.LogMessage(methodName + ": Test Case Pass.");
                Console.WriteLine(methodName + ": Get Response failed.");
            }

            Assert.AreEqual(true, succeed);
        }
开发者ID:barbarossia,项目名称:DIS,代码行数:19,代码来源:Verification.cs

示例9: InvokeHandler

 bool InvokeHandler(HttpResponseMessage response)
 {
     ConditionalGetEventArgs args = new ConditionalGetEventArgs() { Response = response };
     return InvokeHandler(args);
 }
开发者ID:pusp,项目名称:o2platform,代码行数:5,代码来源:PollingAgent.cs

示例10: Because_of

        protected static void Because_of()
        {
            client.DefaultHeaders.Add("If-Match", entity.Version.ToString(System.Globalization.CultureInfo.InvariantCulture));

            response = client.Post(ServiceUrl["Person"] +  string.Format("{0}/Mapping/{1}", entity.Id,
                int.MaxValue), content);
        }
开发者ID:RaoulHolzer,项目名称:EnergyTrading-MDM-Sample,代码行数:7,代码来源:xml_data_invalid.cs

示例11: Because_of

        protected static void Because_of()
        {
            client.DefaultHeaders.Add("If-Match", long.MaxValue.ToString());

            response = client.Post(ServiceUrl["Person"] +  string.Format("{0}/Mapping/{1}", entity.Id,
                entity.Mappings[0].Id), content);
        }
开发者ID:RaoulHolzer,项目名称:EnergyTrading-MDM-Sample,代码行数:7,代码来源:version_conflict.cs

示例12: Because_of

        protected static void Because_of()
        {
            client.DefaultHeaders.Add("If-Match", entity.Mappings[0].Version.ToUnsignedLongVersion().ToString());

            response = client.Post(ServiceUrl["LegalEntity"] +  string.Format("{0}/Mapping/{1}", entity.Id,
                int.MaxValue), content);
        }
开发者ID:RaoulHolzer,项目名称:EnergyTrading-MDM-Sample,代码行数:7,代码来源:xml_data_invalid.cs

示例13: Because_of

        protected static void Because_of()
        {
            client = new HttpClient(ServiceUrl["Counterparty"] +
                "crossmap?source-system=trayport&destination-system=endur&mapping-string=abc");

            response = client.Get();
        }
开发者ID:RaoulHolzer,项目名称:EnergyTrading-MDM-Sample,代码行数:7,代码来源:source_system_mapping_unkown.cs

示例14: Because_of

        protected static void Because_of()
        {
            var entity = CurveData.CreateBasicEntityWithOneMapping();

            client = new HttpClient(ServiceUrl["Curve"] + string.Format("{0}/mapping/{1}", entity.Id, int.MaxValue));

            response = client.Get();
        }
开发者ID:RaoulHolzer,项目名称:EnergyTrading-MDM-Sample,代码行数:8,代码来源:mapping_not_found.cs

示例15: Because_of

        protected static void Because_of()
        {
            client = new HttpClient(ServiceUrl["Exchange"] +
                    "map?source-system=Trayport&mapping-string=" + exchange.Mappings[0].MappingValue + "&as-of=" +
                    exchange.Validity.Start.ToString(DateFormatString));

            response = client.Get();
        }
开发者ID:RaoulHolzer,项目名称:EnergyTrading-MDM-Sample,代码行数:8,代码来源:successful.cs


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