ChromeRestClient icon indicating copy to clipboard operation
ChromeRestClient copied to clipboard

POST with JSON payload to .NET service fails with Error 411

Open bobweil opened this issue 9 years ago • 4 comments

All attempts to post JSON to .NET service cause a complaint about no Content-Length being specified. I would expect the tool to calculate the content length, but I did try pasting the JSON into a text editor and using the byte count from that in a content-length header. No good.

Calling the same service from my AngularJS app and from Python work fine without throwing this exception.

bobweil avatar Feb 10 '17 00:02 bobweil

Hi, Thank you for issue report. In the response section, in request headers there's a source message (a HTTP message that has been sent to the server. Can you check if there was correct content-length header?

The app is calculating content length from the body you provide in the request panel. The text is transformed to ArrayBuffer and the buffer size is the length of the message. This should work as intended because this is how spec defines content-length. I'd need a .NET service to test this behaviour and I won't have chance to do this for at least next 10 days or so. I'll try to test it after this.

jarrodek avatar Feb 11 '17 01:02 jarrodek

Ok, I've nailed down the conditions of the failure a little further. I'm using IIS for the API server.

This bug only exhibits when I use the Chrome REST client with NT Authentication and only on POST. If I use GET or if I allow anonymous authentication on the server, the Chrome REST client works fine and sends the content length header, correctly calculated.

If I permit only Windows NT authentication on the server, then the Chrome REST Client prompts me for my credentials and sends the "authorization: NTLM: header, but does not send the content-length header or the body.

bobweil avatar Feb 14 '17 21:02 bobweil

Hi, has there been any additional research done on this? I am receiving the same 411 Length Required error on PATCH calls for multipart/form-data content types.

acottrell2 avatar Mar 16 '17 16:03 acottrell2

Hi,

Thank you for issue report. It seems that there's an issue with transport library and it doesn't generate the message body when re-creating authenticated request (NTLM). I'll take a closer look into this.

Sorry for the delay but I was traveling and then finishing another project that was already delayed. I'll work on this on weekend.

jarrodek avatar Apr 07 '17 12:04 jarrodek