HTTPHeader
Read, set, and remove named HTTP headers via the Core library HTTPHeader helpers.
Runtime verified
Differs from official docs
The HTTPHeader object provides Core-library helpers for header access in SSJS. Runtime testing shows GetValue reads the inbound request headers while SetValue/Remove operate on outbound headers — the two are separate collections, so you cannot read back a value you just set.
Requires Platform.Load("core", "1.1.5") before use.
Methods
| Method | Returns | Description |
|---|---|---|
HTTPHeader.GetValue(name) |
string | Returns the value of the named inbound request header (e.g. Host, User-Agent); returns null if absent — including for a header set via SetValue |
HTTPHeader.SetValue(name, value) |
void | Sets an outbound header value (host and content-length cannot be changed) |
HTTPHeader.Remove(headerName) |
void | Removes a header entry; returns undefined |
Examples
Platform.Load("core", "1.1.5");
// Read an inbound request header:
var host = HTTPHeader.GetValue("Host");
Write(host);
// Set / remove outbound headers (not readable back via GetValue):
HTTPHeader.SetValue("X-Custom-Header", "example");
HTTPHeader.Remove("X-Custom-Header");
See Also
Platform.Request— incoming request dataPlatform.Response— response helpers (cookies, redirect, content type)