0

I'm using this example and can't move "Accept-Encoding: gzip, deflate" to end headers

using System.Net.Http;
using System.Threading.Tasks;

namespace ConsoleApp3
{
    class Program
    {
        static async Task Main(string[] args)
        {
            var client = new HttpClient();
            client.DefaultRequestHeaders.Add("Host", "www.google.com");
            client.DefaultRequestHeaders.Add("Connection", "keep-alive");
            client.DefaultRequestHeaders.Add("Accept", "*/*");
            client.DefaultRequestHeaders.Add("User-Agent", "Mozilla/5.0 etc");
            await client.GetAsync("http://www.google.com");
            await client.PostAsync("http://www.google.com", new StringContent(""));
        }
    }
}

I read topic Strict ordering of HTTP headers in HttpWebrequest and didn't find answer

I have:

POST /v3/sessions HTTP/2
Host: www.google.com
Accept-Language: en-US
Accept-Encoding: gzip, deflate
Content-Type: application/json; charset=utf-8
Content-Length: 129

{"authToken":"d81932c781288890e2348e622b45b27627696e818d03bdc8c6cc60bb6be1fa43","thirdPartyUserId":"google"}

I need:

   POST /v3/sessions HTTP/2
    Host: www.google.com
    Accept-Language: en-US
    Content-Type: application/json; charset=UTF-8
    Content-Length: 129
    Accept-Encoding: gzip, deflate
    
    {"authToken":"d81932c781288890e2348e622b45b27627696e818d03bdc8c6cc60bb6be1fa43","thirdPartyUserId":"google"}

upd. I did it with curl requests

AndrewT
  • 1
  • 1

0 Answers0