本文整理汇总了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)
};
}
示例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;
}
示例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);
}
示例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") };
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
示例9: InvokeHandler
bool InvokeHandler(HttpResponseMessage response)
{
ConditionalGetEventArgs args = new ConditionalGetEventArgs() { Response = response };
return InvokeHandler(args);
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
示例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();
}
示例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();
}