HTTP/1.1 request with body and without content-type

450 Views Asked by At

How to identify whether an http request has body or not. Referred this HTTP response headers valid with no Transfer-Encoding and Content-Length?. The request made from swagger ui has body and no content-type. But when checking the request it does not have either transfer encoding header or content-length header. How to identify whether it has a body or not.

1

There are 1 best solutions below

0
On

Content-Type is entirely irrelevant for this.

The full (complex) algorithm to determine the message size is described in RFC 7230. See https://greenbytes.de/tech/webdav/rfc7230.html#rfc.section.3.3.3.