當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。