Web Api2项目,,, Controller继承自另一个控制器,,,,需要以json格式获取每个请求和响应的正文和头部
答案 0 :(得分:1)
尝试使用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);
}
}