RequestModule
PackageAxial.Hosting.AspNetCore
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. |
| form | Request.form schema | Reads and schema-parses a posted form. |
| query | Request.query schema | Schema-parses the query string. |
| 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. |
| route | Request.route name schema | Schema-parses one named ASP.NET route value. |
| raw | Request.raw projection | Projects untrusted input directly from the native request without schema parsing. |
| native | Request.native | Returns the native ASP.NET 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
kind: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 422 (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
Schema-parses one named ASP.NET route value.
Parameters
| Name | Type | Description |
|---|---|---|
| name | string | The route-value name registered in the ASP.NET route pattern. |
| schema | Schema<'model> | The schema that parses the scalar route text. |
Returns
Flow<HttpEndpointEnv<'app>, EndpointError<'error>, 'model>
Verification Examples
let! userId = Request.route "id" UserId.schemakind:member
Projects untrusted input directly from the native request without schema parsing.
Parameters
| Name | Type | Description |
|---|---|---|
| projection | HttpRequest -> '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"])
