Skip to main content

Request

Every route handler receives a PrismHTTPRequest — a struct containing everything about the incoming HTTP request.

Anatomy of a Request

Reading Headers

Headers
Header lookups are case-insensitive. "content-type" and "Content-Type" both work.

JSON Body

Parse JSON from the request body:
JSON Parsing
Or work with raw JSON:
Raw JSON

Form Data

URL-encoded form data is parsed automatically:
Form Data

Nested Form Data

For complex forms with nested fields:
Nested Forms

Multipart File Uploads

Handle file uploads from HTML forms:
File Upload

XML Body

Parse XML from the request body:
XML Parsing

Query Parameters

Query Parameters

Route Parameters

Captured from the URL pattern:
Route Parameters

Request Validation

Validate incoming data declaratively:
Validation

Custom Data via UserInfo

Middleware can store data for downstream handlers:
UserInfo

Response

Learn how to build and send responses.

Validation

Deep dive into request validation rules.