Search code examples
c#restsharp

Is it possible to send HEAD request with RestSharp?


I'm trying to send HEAD request to server to get a file length from Content-Length header, but I always get 'Not Acceptable' in response when I'm using RestSharp. Id I create request with simple .NET WebRequest it work good.

I tried to clear all header and other stuff from request and client, but had no success

Is it possible to do this request with RestSharp and how?

Thanks in advance


Solution

  • Solved the problem with

    restRequest.Parameters.Clear();
    restRequest.AddHeader("Accept", "*/*");