std.net.http.server.Handle
trait pub HandleA type that handles a single request and produces its response.
Required methods
handle
Show source codeHide source code
fn pub mut handle(request: mut Request) -> Responsefn pub mut handle(request: mut Request) -> ResponseHandles an incoming request and produces its response.
Default methods
invalid_request
Show source codeHide source code
fn pub mut invalid_request(response: Response) -> Response {
response
}fn pub mut invalid_request(response: Response) -> ResponseA method called when a request can't be parsed, such as when its syntax is invalid.
The response argument is a default Response generated for the type of
error.
The return value is the Response presented to the client. The default
implementation of this method returns the response as-is.
response
Show source codeHide source code
fn pub mut response(request: mut Request, response: Response) -> Response {
response
}fn pub mut response(request: mut Request, response: Response) -> ResponseA method called before writing a response.
This method is only called if a request could be parsed, otherwise
Handle.invalid_request is called instead.
This method allows customizing of Response values at the
application-level, such as by wrapping them in a layout or by adding extra
headers. It can also be used for logging requests along with their response.
The default implementation of this method returns the Response as-is.