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.
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.