[英]Need to get request and response body and head in web Api2 project .How can i do it?
Web Api2項目,,,Controller繼承自另一個控制器,,,,需要獲取json格式的每個請求和響應的body和head
嘗試使用DelegatingHanler
攔截請求,如下所示
public class IntercepterMessageHandler : DelegatingHandler
{
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
{
//try to manipulate the request object
return base.SendAsync(request, cancellationToken);
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.