Get HTTP Header
The Get HTTP Header block reads one header from the request that started the flow, like Authorization or User-Agent, and passes its value to the next block.
When to use it
- Read an API key or token that the caller sent.
- Check what kind of client is calling, with
User-AgentorAccept-Language. - Don't use it for data in the URL. Use Get HTTP Param for that.
- Don't use it for data in the body. Use Get HTTP Request Body.
- Don't use it for cookies. Use Get Request Cookie.
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 header to read. Can be a JS expression. Capital letters don't matter: Authorization and authorization are the same header. |
Outputs
| Handle | When it is used |
|---|---|
| Next (right) | Always. The next block receives the header's value as text. |
Example
The caller sent Authorization: Bearer abc123.
| Field | Value |
|---|---|
| Name | Authorization |
The next block receives "Bearer abc123" as its input.
Single or Multiple
Pick Multiple to read several headers in one block. Each row has a Name.
- The output is an array with one value per row, in row order.
- A missing header gives
""for its row. The other rows still work.
With rows Authorization and User-Agent, the next block receives something like ["Bearer abc123", "curl/8.4.0"].
How it behaves
- A missing header is empty text. If the caller didn't send it, the value is
"". It is not an error. Check it with an If Condition using Is Empty/Null. - It replaces the flowing data. The next block's
inputis the header value, not what came before. To keep earlier data, store it first with Set Variable. - Read-only. It never changes the request.
Related blocks
- Get Request Cookie: read a cookie instead.
- Get HTTP Param: read a query or path value.
- Set HTTP Header: add a header to the response.
- If Condition: react to a missing or wrong value.
