RequestModule

PackageAxial.Hosting.GenHttp
Request decoders that contribute trusted values to an endpoint Flow.

Summary

NameSignatureSynopsis
Operations
jsonRequest.json schemaReads and schema-parses a JSON request body; malformed JSON and schema diagnostics become invalid-request failures.
queryRequest.query schemaSchema-parses the query string.
formRequest.form schemaReads and schema-parses a posted application/x-www-form-urlencoded form.
parseFormRequest.parseForm schemaSchema-parses a posted form and returns the outcome with the input it came from, for a page that shows the form again with its errors.
parseQueryRequest.parseQuery schemaSchema-parses the query string and returns the outcome with the input it came from, for a page that shows its filters again with their errors.
rawRequest.raw projectionProjects untrusted input directly from the native request without schema parsing.
nativeRequest.native Returns the native GenHTTP request for host-specific boundary handling.

Operations

kind:member

json

Request.json schema
Member
Reads and schema-parses a JSON request body; malformed JSON and schema diagnostics become invalid-request failures.

Parameters

NameTypeDescription
schemaSchema<'model>The schema that establishes the trusted input type.

Returns

Flow<HttpEndpointEnv<'app>, EndpointError<'error>, 'model>

Verification Examples

let! signup = Request.json Signup.schema
kind:member

query

Request.query schema
Member
Schema-parses the query string.

Parameters

NameTypeDescription
schemaSchema<'model>The schema that interprets the complete query input.

Returns

Flow<HttpEndpointEnv<'app>, EndpointError<'error>, 'model>

Verification Examples

let! search = Request.query Search.schema
kind:member

form

Request.form schema
Member
Reads and schema-parses a posted application/x-www-form-urlencoded form.

Parameters

NameTypeDescription
schemaSchema<'model>The schema that interprets the form name/value input.

Returns

Flow<HttpEndpointEnv<'app>, EndpointError<'error>, 'model>

Verification Examples

let! signup = Request.form Signup.schema
kind:member

parseForm

Request.parseForm schema
Member
Schema-parses a posted form and returns the outcome with the input it came from, for a page that shows the form again with its errors.

Parameters

NameTypeDescription
schemaSchema<'model>The schema that interprets the form name/value input.

Returns

Flow<HttpEndpointEnv<'app>, EndpointError<'error>, RetainedParseResult<'model>>

Verification Examples

match! Request.parseForm Signup.schema with
| { Result = Ok signup } -> ...
| invalid -> return Response.html ResponseStatus.UnprocessableEntity (SignupView.form invalid)
kind:member

parseQuery

Request.parseQuery schema
Member
Schema-parses the query string and returns the outcome with the input it came from, for a page that shows its filters again with their errors.

Parameters

NameTypeDescription
schemaSchema<'model>The schema that interprets the complete query input.

Returns

Flow<HttpEndpointEnv<'app>, EndpointError<'error>, RetainedParseResult<'model>>

Verification Examples

let! search = Request.parseQuery Search.schema
kind:member

raw

Request.raw projection
Member
Projects untrusted input directly from the native request without schema parsing.

Parameters

NameTypeDescription
projectionIRequest -> 'inputThe direct projection from the native request.

Returns

Flow<HttpEndpointEnv<'app>, EndpointError<'error>, 'input>

Verification Examples

let! signature = Request.raw (fun request -> string request.Headers["x-signature"])
kind:member

native

Request.native
Member
Returns the native GenHTTP request for host-specific boundary handling.

Returns

Flow<HttpEndpointEnv<'app>, EndpointError<'error>, IRequest>

Verification Examples

let! request = Request.native