Quantcast
Channel: ASPNETWebStack Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 7215

Edited Issue: WebAPI OData needs HEAD support [785]

$
0
0
Excel, and others often issue HEAD requests (particularly when asking for metadata) to see if anything has changed.

Currently HEAD is an unsupported method.

As a workaround (non-optimal), you can implement a DelegatingHandler message handler and override SendAsync (lots of example online about how to override and insert a message handler in the configuration).

Before the base.SendAsync() call, you can then do something like the following:

bool isHead = request.Method == HttpMethod.Head;
if (isHead)
request.Method = HttpMethod.Get;

Which will change HEAD -> GET. After the call you can then blank the response:

if (isHead)
{
// We are head request, so blank the content.
response.Content = null;
}

Hope that helps someone else.

Viewing all articles
Browse latest Browse all 7215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>