[英]Need to get request and response body and head in web Api2 project .How can i do it?
Web Api2项目,,,Controller继承自另一个控制器,,,,需要获取json格式的每个请求和响应的body和head
try to intercept the request using the DelegatingHanler
something like the following尝试使用
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.