Represents an HTTP request that is passed through interceptors before being sent to the server.
Interceptors may mutate any field. The serializeBody method serializes the body to JSON
if it is still a RequestMessage, or returns the existing bytes if already serialized.
Serializes the request body to JSON if it is still a RequestMessage.
If body is already a Buffer, returns it as-is (idempotent).
Sets Content-Type and Content-Length headers on successful serialization.
Returns Buffer
The serialized body as a Buffer.
Throws
Error if body is neither a RequestMessage nor a Buffer.
Represents an HTTP request that is passed through interceptors before being sent to the server. Interceptors may mutate any field. The serializeBody method serializes the body to JSON if it is still a RequestMessage, or returns the existing bytes if already serialized.