What is Request Payload / Payload Body 2019

What is Request Payload / Payload Body 2019

Http request payload

When data is sent over the Internet, each unit transmitted includes both
header information and the actual data being sent. The header identifies the source and destination of the packet, while the actual data is referred to as the payload. Because header information, or overhead data, is only used in the transmission process, it is stripped from the packet when it reaches its destination. Therefore, the body of the request (request payload) is the only data received by the destination system.

It can also defined as the “actual data” in a packet or file minus all headers attached for transport and minus all descriptive meta-data. In a network packet, headers are appended to the payload for transport and then discarded at their destination. In a key-length-value structure, the key and length are descriptive data about the value (the payload).

Payload body of a HTTP Request – is the data normally send by a POST or PUT Request. It’s the part after the headers and the CRLF (Carriage Return (ASCII 13, \r) Line Feed (ASCII 10, \n)) of a HTTP Request.

A request with Content-Type: application/json may look like this:

POST /some-path HTTP/1.1
Content-Type: application/json

{ "foo" : "bar", "name" : "John" }

Here { "foo" : "bar", "name" : "John" } is the payload body. Here browser doesn’t know the source of request coming from.

If you submit a HTML-Form with method="POST" and Content-Type: application/x-www-form-urlencoded or Content-Type: multipart/form-data your request may look like this:

POST /some-path HTTP/1.1
Content-Type: application/x-www-form-urlencoded

foo=bar&name=John

Here foo=bar&name=John is the payload body. Difference is that here browser knows that the data is coming from the form submission because of type: x-www-form-urlencoded.

References: https://tools.ietf.org/html/draft-ietf-httpbis-p3-payload-14#section-3.2

Conclusion: Note that what constitutes the payload may depend on the point-of-view. To a communications layer that needs some of the overhead data to do its job, the payload is sometimes considered to include the part of the overhead data that this layer handles. However, in more general usage, the payload is the bits that get delivered to the end user at the destination.

One Reply to “What is Request Payload / Payload Body 2019”

Leave a Reply