djmnz / RestFluencing

MIT License
11 stars 4 forks source link

Passing content in GET request #15

Open natn2323 opened 5 years ago

natn2323 commented 5 years ago

Does this framework support sending GET requests with a body? I have tested it like so, without any success:

Rest.Get("MyUrl/")
    .WithJsonBody(new { type = "SpecialType" })
    .Response()
    .Assert();
djmnz commented 5 years ago

@natn2323 are you able to advise whether you are running the tests on .Net Framework 4.x or .Net Core?

It looks like there is a limitation on the full .net framework implementation of the httpclient... see here https://stackoverflow.com/questions/43421126/possible-for-httpclient-to-send-content-or-body-for-get-request

RestFluencing already adheres to that implementation - i.e. we manually create the HttpRequestMessage and set the verb manually rather than using the defaults of the HttpClient.

Also, do you know what is the server receiving? It could also be a content type or some other header missing to help the server interpret it.