Request Document
The request document is a transient HTML document that represents the current HTTP request. It exists only for the duration of request processing and is addressable via resource bindings and includes during page composition.
Caching. Because the request document carries per-request identity (the
authscope), any page that includes or binds a fragment of it is servedCache-Control: privateand is excluded from the shared cache. The request document is internal: it is not itself addressable over HTTP.Reading a field directly. If you only need a request field (not a selector-addressable fragment), the same data is available as the
requestcontext variable —request.auth.claims.email,request.path,request.method,request.query.*— inside expression bindings and Liquid templates, without a selector.
API keys.
request.authis filled in for an API key only when the host'sApiKeyAuthenticationfeature recognises the header and prefix the key is sent in. A key that is not recognised is ignored, as if it had not been sent. The request then has the caller's session if there is one, and is anonymous otherwise. A key sent in theAuthorizationheader is always removed. A key in any other header is passed on as an ordinary header and gives no identity.request.auth.claims.emailis present only if the feature'skey-queryreturns an email.
When to reach for it
Use the request document to access request metadata — path, method, query parameters, headers, and authentication claims — inside templates and bindings. The document does not persist after the request completes.
Shape
The request document uses the https://pagelove.org/Request itemtype. It contains nested scopes for query parameters, headers, and authorization claims.
<!doctype html>
<html lang="en">
<head></head>
<body itemscope itemtype="https://pagelove.org/Request">
<meta itemprop="path" content="/index.html">
<meta itemprop="method" content="GET">
<meta itemprop="query" content="foo=bar">
<meta itemprop="body" content="">
<section itemprop="query" itemscope itemtype="https://pagelove.org/Request/HTTP/Query">
<meta itemprop="foo" content="bar">
</section>
<section itemprop="headers" itemscope itemtype="https://pagelove.org/Request/HTTP/Headers">
<meta itemprop="accept" content="text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=8">
<meta itemprop="host" content="docs.pagelove.org">
<meta itemprop="accept-language" content="en-GB,en;q=0.9">
</section>
<section itemprop="auth" itemscope itemtype="https://pagelove.org/Authorization">
<section itemprop="claims" itemscope itemtype="https://pagelove.org/Claims">
<meta itemprop="email" content="james@pagelove.team">
<meta itemprop="name" content="James A. Duncan">
<meta itemprop="sub" content="sub_X3jXrDQvxAJl4s7Y6BVZ6JvE_ipt">
<meta itemprop="picture" content="https://pictures.hello.coop/r/cf47a516-b15b-42c5-bea5-d2694a00be78.jpeg">
<meta itemprop="pagelove_credential" content="session">
</section>
<meta itemprop="username" content="sub_X3jXrDQvxAJl4s7Y6BVZ6JvE_ipt">
<meta itemprop="role" content="james@pagelove.team">
<meta itemprop="role" content="admins">
<meta itemprop="role" content="staff">
<meta itemprop="role" content="users">
</section>
</body>
</html>
Fields
| Field | Itemtype | Description |
|---|---|---|
path |
— | The request path |
method |
— | The HTTP method |
query |
https://pagelove.org/Request/HTTP/Query |
Parsed query parameters as individual properties |
body |
— | The raw request body, as text. This is the request document only. In a Liquid template or expression, request.body is the parsed body instead: see Reading form fields in the template. |
headers |
https://pagelove.org/Request/HTTP/Headers |
Request headers as individual properties |
auth |
https://pagelove.org/Authorization |
Authentication and authorization data, including OIDC claims and roles. The claims include pagelove_credential, which the edge proxy sets to session for a signed-in session, or to api-key for a request signed in with a key |
Examples
Request object in a Liquid template
In Liquid, request.body holds the body parsed by its content type: a map of fields for a form or multipart post, the parsed value for JSON, and the raw string for anything else. request.rawBody holds the unparsed text. See Reading form fields in the template.
Store a page that renders request properties using p:template:
<!DOCTYPE html>
<html p:template="text/liquid" xmlns:p="https://pagelove.org/1.0">
<head>
<title>Request object demo</title>
</head>
<body>
<h1>Request details</h1>
<p>Method: {{ request.method }}</p>
<p>Path: {{ request.path }}</p>
</body>
</html>
When the page is requested, the template evaluates with the live request data:
GET /sspi-reqobj-page.html
HTTP/1.1 200
<!DOCTYPE html>
<html>
<body>
<section>
<p>Method: GET</p>
<p>Path: /sspi-reqobj-page.html</p>
</section>
</body>
</html>
See also
- Resource Binding — bind CSS selector queries to template variables
- Templating — render request data in Liquid templates