Http Outgoing¶
Import: import system.webapi;
See the Web APIs guide for runnable examples, lifecycle, and error behavior.
HttpOutgoing¶
Outbound HTTP response built by handlers and middleware.
status¶
HTTP response status code.
headers¶
HTTP headers associated with this message.
body¶
Text response body.
body_bytes¶
Binary response body; use bytes to construct a binary response.
constructor¶
Creates a HttpOutgoing with status, body.
set_header¶
Sets a response header and returns this response for chaining.
text¶
Creates a plain-text response with status 200 unless another status is supplied.
html¶
Creates an HTML response with status 200 unless another status is supplied.
json_text¶
Creates a JSON response from already encoded JSON text; does not serialize or validate the text.
detail¶
FastAPI-style {"detail": "..."} JSON error.
from_body_error¶
A 400 response for a failed body read; invalid input such as a form over its limits keeps the failure message as the detail.
from_validation¶
A structured validation response, prefixed with the input source.
invalid_input¶
Creates a 422 validation-error response describing the invalid input and its location.
public static fun invalid_input(
source: string,
name: string,
code: string,
message: string
): HttpOutgoing
already_sent¶
Creates a marker indicating that the response has already been sent.
bytes¶
Creates a binary response from data, with status 200 by default.
from_status¶
Creates a response using the supplied status code and message.
not_found¶
Creates a 404 Not Found response.
method_not_allowed¶
Creates a 405 Method Not Allowed response whose Allow header lists allowed, the methods that the requested path accepts, separated by ,.
empty¶
Creates a response without a body, with status 204 by default.