RequestModule
PackageAxial.Hosting.GenHttp
Request decoders that contribute trusted values to an endpoint Flow.
Summary
| Name | Signature | Synopsis |
|---|---|---|
| Operations | ||
| json | Request.json schema | Reads and schema-parses a JSON request body; malformed JSON and schema diagnostics become invalid-request failures. |
| query | Request.query schema | Schema-parses the query string. |
| form | Request.form schema | Reads and schema-parses a posted application/x-www-form-urlencoded form. |
| parseForm | Request.parseForm schema | 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. |
| parseQuery | Request.parseQuery schema | 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. |
| raw | Request.raw projection | Projects untrusted input directly from the native request without schema parsing. |
| native | Request.native | Returns the native GenHTTP request for host-specific boundary handling. |
Operations
kind:member
Reads and schema-parses a JSON request body; malformed JSON and schema diagnostics become invalid-request failures.
Parameters
| Name | Type | Description |
|---|---|---|
| schema | Schema<'model> | The schema that establishes the trusted input type. |
Returns
Flow<HttpEndpointEnv<'app>, EndpointError<'error>, 'model>
Verification Examples
let! signup = Request.json Signup.schemakind:member
kind:member
Reads and schema-parses a posted
application/x-www-form-urlencoded form.Parameters
| Name | Type | Description |
|---|---|---|
| schema | Schema<'model> | The schema that interprets the form name/value input. |
Returns
Flow<HttpEndpointEnv<'app>, EndpointError<'error>, 'model>
Verification Examples
let! signup = Request.form Signup.schemakind: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
| Name | Type | Description |
|---|---|---|
| schema | Schema<'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
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
| Name | Type | Description |
|---|---|---|
| schema | Schema<'model> | The schema that interprets the complete query input. |
Returns
Flow<HttpEndpointEnv<'app>, EndpointError<'error>, RetainedParseResult<'model>>
Verification Examples
let! search = Request.parseQuery Search.schemakind:member
Projects untrusted input directly from the native request without schema parsing.
Parameters
| Name | Type | Description |
|---|---|---|
| projection | IRequest -> 'input | The 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"])
