Get Request Cookie
The Get Request Cookie block reads one cookie that the caller's browser sent, like a session id, and passes its value to the next block.
When to use it
- Read a session or login cookie to find out who is calling.
- Read a small preference the browser stored, like a language.
- Don't use it for cookies you want to send. Use Set HTTP Cookie for that.
- Don't use it for headers. Use Get HTTP Header.
Inputs
| Field | Required | Default | What it does |
|---|---|---|---|
| Mode | No | Single | Single handles one value. Multiple handles a list of rows, see below. |
| Name | Yes | none | The cookie to read. Can be a JS expression. |
Outputs
| Handle | When it is used |
|---|---|
| Next (right) | Always. The next block receives the cookie's value as text. |
Example
The browser sent the cookie session=abc123.
| Field | Value |
|---|---|
| Name | session |
The next block receives "abc123" as its input. A DB Get Single can then look up that session.
Single or Multiple
Pick Multiple to read several cookies in one block. Each row has a Name.
- The output is an array with one value per row, in row order.
- A missing cookie gives
""for its row. The other rows still work.
With rows session_id and theme, the next block receives something like ["abc123", "dark"].
How it behaves
- A missing cookie is empty text. If the browser didn't send it, the value is
"". It is not an error. - It replaces the flowing data. The next block's
inputis the cookie value, not what came before. Store earlier data first with Set Variable. - Read-only. It never changes the cookie. To change or remove it, use Set HTTP Cookie.
Related blocks
- Set HTTP Cookie: send a cookie back.
- Get HTTP Header: read a header.
- If Condition: check whether the cookie exists.
