KScript docs
EN

Web pages

The request

$request holds the request a page is answering: method, scheme, path, url, query, form, headers, cookies, params and body. For https://example.com/people?page=2, $request.scheme is https, $request.path is /people and $request.url is /people?page=2:

HTML page
<let name="page" value="($request.query.page ?? '1')->to_number(default: 1)" />
<p>Page {$page} of the people list, at {$request.path}</p>

A value in query or form is text. A name sent more than once (?tag=a&tag=b, or a group of checkboxes) is a list of texts. For an ordinary form post, body is the text as sent (name=Ada&tag=a). For a form with files it is empty. A page under a locale prefix also gets $request.locale.