18.4.0 released Sep 25, 2023
Request body

Purpose: Get the body of an HTTP request.

request-body <request body> [ length [ define ] <body length> ]

request-body stores the request body of an HTTP request into string <request body> which can hold text or binary data and which is created for that purpose. In either case, optional "length" clause provides the length in bytes of the body in <body length> variable, which can be created with optional "define".

If the content type of the request is "multipart/form-data", the request body is empty because all the data (including any attached files) can be obtained by using input-param (see file-uploading for files). In all other cases, request body is available.

Typical use of request-body is when some text or binary information is attached to the request, such as JSON for example, though it can be anything else, for example an image, some text, or a PDF document. Usually request body is present for POST, PUT or PATCH requests, but you can also obtain it for GET or DELETE requests, if supplied (for instance identifying a resource may require more information than can fit in a query string), or for any custom request method.
String variable "reqb" will hold request body of a request and "reqb_length" will be its length in bytes:
request-body reqb length define reqb_length

See also
Request information
See all

You are free to copy, redistribute and adapt this web page (even commercially), as long as you give credit and provide a link back to this page (dofollow) - see full license at CC-BY-4.0. Copyright (c) 2019-2023 Dasoftver LLC. Vely and elephant logo are trademarks of Dasoftver LLC. The software and information on this web site are provided "AS IS" and without any warranties or guarantees of any kind.