エラーが発生した場合にHttpWebResponse
HTTP応答を(の形式で)キャプチャする方法を知っていますが、メソッドが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?
または、別の応答クラスをキャプチャする必要がありますか?