[英]How do I get an HttpWebResponse for “200 OK”?
我知道如何在出现错误的情况下捕获HTTP响应(以HttpWebResponse
的形式),但是当方法返回200 OK时如何执行此操作? 我想统一处理所有的回复。
// IService.cs
public async Task Ping();
// Client.cs
public static void ReactToHttpResponse(HttpWebResponse res)
{
// Play with the http response ...
}
await service.Ping(); // => 200 OK, on the wire
ReactToHttpResponse(/* ??? */) // How to capture the HttpWebResponse?
或者我应该捕获不同的响应类?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.