ResponseModule
PackageAxial.Hosting.AspNetCore
Successful responses returned by endpoint Flows.
Summary
| Name | Signature | Synopsis |
|---|---|---|
| Operations | ||
| json | Response.json statusCode codec value | Streams a trusted value as JSON through a compiled codec. |
| empty | Response.empty statusCode | Returns an empty response with the supplied status code. |
| text | Response.text statusCode value | Returns a plain-text response. |
| html | Response.html statusCode html | Returns an HTML response, such as a page or the fragment an htmx request swaps in. |
| redirect | Response.redirect statusCode location | Returns a redirect to another address. |
| withHeader | Response.withHeader name value response | Adds a header to a response, replacing a value already set under that name. |
| native | Response.native result | Returns a host-native ASP.NET result unchanged. |
Operations
kind:member
Streams a trusted value as JSON through a compiled codec.
Parameters
| Name | Type | Description |
|---|---|---|
| statusCode | int | The successful HTTP status code. |
| codec | JsonCodec<'model> | The compiled codec for the trusted output type. |
| value | 'model | The trusted output value. |
Returns
IResult
Verification Examples
return Response.json 201 Signup.codec signupkind:member
kind:member
kind:member
kind:member
Returns a redirect to another address.
Parameters
| Name | Type | Description |
|---|---|---|
| statusCode | int | The redirect status: 303 after a form post, 302 or 307 for a temporary move, 301 or 308 for a permanent one. |
| location | string | The address sent in the Location header. |
Returns
IResult
Verification Examples
return Response.redirect 303 "/signups"kind:member
Adds a header to a response, replacing a value already set under that name.
Parameters
| Name | Type | Description |
|---|---|---|
| name | string | The header name. |
| value | string | The header value. |
| response | IResult | The response to add the header to. |
Returns
IResult
Verification Examples
return
Response.html 200 fragment
|> Response.withHeader "HX-Push-Url" address
|> Response.withHeader "HX-Trigger" "saved"
