Skip to content

Commit

Permalink
Update expression examples (request body fields)
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrosousa committed Jan 10, 2025
1 parent bc1080c commit 82ed284
Showing 1 changed file with 38 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,14 @@ The return value may be truncated if [`http.request.body.truncated`](#httpreques
- **Whitespace:** preserved
- **Non-ASCII:** preserved

Example:

```txt
any(http.request.body.form["username"][*] == "admin")
```

Example value:

`{username": ["admin"]}`

Example:

`any(http.request.body.form["username"][*] == "admin")`

## `http.request.body.form.names`

`http.request.body.form.names` <Type text='Array<String>' />
Expand All @@ -97,16 +96,14 @@ The return value may be truncated if [`http.request.body.truncated`](#httpreques
- **Whitespace:** preserved
- **Non-ASCII:** preserved

Example:

```txt
any(http.request.body.form.names[*] == "username")
```

Example value:

`["username"]`

Example:

`any(http.request.body.form.names[*] == "username")`

## `http.request.body.form.values`

`http.request.body.form.values` <Type text='Array<String>' />
Expand All @@ -123,16 +120,14 @@ The return value may be truncated if [`http.request.body.truncated`](#httpreques
- **Whitespace:** preserved
- **Non-ASCII:** preserved

Example:

```txt
any(http.request.body.form.values[*] == "admin")
```

Example value:

`["admin"]`

Example:

`any(http.request.body.form.values[*] == "admin")`

## `http.request.body.mime`

`http.request.body.mime` <Type text='String' />
Expand All @@ -141,9 +136,13 @@ 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 value:

`"image/jpeg"`

Example:

`image/jpeg`
`http.request.body.mime in {"image/bmp" "image/gif" "image/jpeg" "image/png" "image/tiff"}`

This field is available on all Cloudflare plans.

Expand All @@ -155,7 +154,11 @@ A Map (or associative array) representation of multipart names to multipart valu

Example value:

`{"username": ["alice_doe"], "picture": [<binary_content_of_file>]}`
`{"username": ["alice_doe"], "role": ["editor"], "picture": [<binary_content_of_file>]}`

Example:

`any(http.request.body.multipart["role"][*] == "admin")`

## `http.request.body.multipart.names`

Expand All @@ -181,6 +184,10 @@ Example value:

`["alice_doe", <binary_content_of_file>]`

Example:

`any(http.request.body.multipart.values[*] == "alice_doe")`

## `http.request.body.multipart.content_types`

`http.request.body.multipart.content_types` <Type text='Array<Array<String>>' />
Expand All @@ -203,11 +210,11 @@ List of `Content-Disposition` headers for each part in the multipart body.

Example value:

`[["form-data; name=\"username\""], ["form-data;name=\"picture\""]]`
`[["form-data; name=\"username\""], ["form-data; name=\"picture\""]]`

Example:

`any(http.request.body.multipart.content_dispositions[*][0] in {"form-data; name=\"username\"" "form-data;name=\"picture\""})`
`any(http.request.body.multipart.content_dispositions[*][0] in {"form-data; name=\"username\"" "form-data; name=\"picture\""})`

## `http.request.body.multipart.content_transfer_encodings`

Expand All @@ -217,7 +224,11 @@ List of `Content-Transfer-Encoding` headers for each part in the multipart body.

Example value:

`[["quoted-printable"], ["quoted-printable"]]`
`[["quoted-printable"], ["base64"]]`

Example:

`any(http.request.body.multipart.content_transfer_encodings[*][0] == "binary")`

## `http.request.body.multipart.filenames`

Expand All @@ -228,3 +239,7 @@ List of filenames for each part in the multipart body.
Example value:

`[["file1.txt"], ["photo.jpg"]]`

Example:

`any(http.request.body.multipart.filenames[*][0] in {"token.txt" "password.txt"})`

0 comments on commit 82ed284

Please sign in to comment.