HTTP request body fields
The Rules language includes fields that represent properties of an HTTP request body. Many of these return arrays containing the respective values.
The Cloudflare Rules language supports these HTTP body fields.
http.request.body.raw
String
Represents the unaltered HTTP request body.
When the value of http.request.body.truncated
is true, the return value may be truncated.
- Decoding: no decoding performed
- Whitespace: preserved
- Non-ASCII: preserved
http.request.body.truncated
Boolean
Indicates whether the HTTP request body is truncated.
When true, http.request.body
fields may not contain all of the HTTP request body.
http.request.body.size
Number
The total size of the HTTP request body (in bytes).
http.request.body.form
Map<Array>String>>
Represents the HTTP request body of a form as a Map (or associative array). Populated when the Content-Type header is application/x-www-form-urlencoded
.
The values are not pre-processed and retain the original case used in the request.
When a field repeats, then the array contains multiple items in the order they are in the request.
The return value may be truncated if http.request.body.truncated
is true.
- Decoding: no decoding performed
- Whitespace: preserved
- Non-ASCII: preserved
Example:
Example value:
{username": ["admin"]}
http.request.body.form.names
Array<String>
Represents the names of the form fields in an HTTP request where the content type is application/x-www-form-urlencoded
.
The names are not pre-processed and retain the original case used in the request. They are listed in the same order as in the request.
Duplicate names are listed multiple times.
The return value may be truncated if http.request.body.truncated
is true.
- Decoding: no decoding performed
- Whitespace: preserved
- Non-ASCII: preserved
Example:
Example value:
["username"]
http.request.body.form.values
Array<String>
Represents the values of the form fields in an HTTP request where the content type is application/x-www-form-urlencoded
.
The values are not pre-processed and retain the original case used in the request. They are listed in the same order as in the request.
Duplicated values are listed multiple times.
The return value may be truncated if http.request.body.truncated
is true.
- Decoding: no decoding performed
- Whitespace: preserved
- Non-ASCII: preserved
Example:
Example value:
["admin"]
http.request.body.mime
String
The MIME type of the request detected from the request body.
Supports the most common MIME types of the following general categories: video, audio, image, application, text.
Example:
image/jpeg
This field is available on all Cloudflare plans.