respond
Send an entire HTTP response to the client, including headers and body.
Automatically handles HEAD requests by omitting the body.
Unless transfer_encoding is specified, uses the "content-length"
header.
If the request contains a body and the connection is to be reused,
discards the request body, leaving the Server in the ready state. If
this discarding fails, the connection is marked as not to be reused and
no error is surfaced.
Asserts status is not continue.
Asserts that "\r\n" does not occur in any header name or value.
Function parameters
Parameters
- request:*Request
- content:[]const u8
Type definitions in this namespace
Types
Initialize an HTTP server that can respond to multiple requests on the same
Functions
- init
- Initialize an HTTP server that can respond to multiple requests on the same
Error sets in this namespace
Error Sets
Source
Implementation
pub fn respond(
request: *Request,
content: []const u8,
options: RespondOptions,
) ExpectContinueError!void {
try respondUnflushed(request, content, options);
try request.server.out.flush();
}