What is the difference between a request payload and request body?
Payload is the "wrapper" to the body
Payload is something one carries. A paperboy's payload is a pile of newspapers and a HTTP POST request's payload is whatever comes in the "body".
Definition of: payload : 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.
Edit: In Http protocol, an http packet has http headers and http payload.So payload section of http packet may or may not have a body depending upon the type of request (e.g. POST vs GET). So payload and body are not the same thing.
There are two important HTTP concepts to distinguish: representations and messages.
The latest HTTP definition of representation is given in draft-ietf-httpbis-semantics-latest:
3.2. Representations
A representation is information that is intended to reflect a past, current, or desired state of a given resource, in a format that can be readily communicated via the protocol. A representation consists of a set of representation metadata and a potentially unbounded stream of representation data (Section 8).
Notice that the definition is independent of the version of HTTP because it is about semantics.
The latest HTTP/1.1 definition of message is given in draft-ietf-httpbis-messaging-latest:
2.1. Message Format
An HTTP/1.1 message consists of a start-line followed by a CRLF and a sequence of octets in a format similar to the Internet Message Format [RFC5322]: zero or more header field lines (collectively referred to as the "headers" or the "header section"), an empty line indicating the end of the header section, and an optional message body.
HTTP-message = start-line CRLF *( field-line CRLF ) CRLF [ message-body ]
Notice that the definition depends on the version of HTTP because it is about syntax.
The first HTTP/1.1 definition of payload was given in draft-ietf-httpbis-p3-payload-11 published on 4 August 2010 (bold emphasis mine):
3. Payload
HTTP messages MAY transfer a payload if not otherwise restricted by the request method or response status code. The payload consists of metadata, in the form of header fields, and data, in the form of the sequence of octets in the message-body after any transfer-coding has been decoded.
A "payload" in HTTP is always a partial or complete representation of some resource. We use separate terms for payload and representation because some messages contain only the associated representation's header fields (e.g., responses to HEAD) or only some part(s) of the representation (e.g., the 206 status code).
So a payload is a part of a representation enclosed in a message. If the representation spans multiple messages, the payload of each message is a partial representation, otherwise the payload of the single message is a complete representation.
A payload consists of payload metadata (a part of representation metadata enclosed in a message) and payload data (a part of representation data enclosed in a message).
A message body is payload data encoded for transfer, if any.
Payload data are also called content in draft-ietf-httpbis-semantics-latest:
The terms "payload" and "payload body" have been replaced with "content", to better align with its usage elsewhere (e.g., in field names) and to avoid confusion with frame payloads in HTTP/2 and HTTP/3. (Section 6.4)