Skip to main content

Module html

Module html 

Source
Expand description

HTML responses: shortcut for returning rendered markup from handlers.

HtmlServiceResult::ok wraps an HTML string in a 200 ServiceResult with ResponseType::Html, so the router renders it as text/html.

async fn page(ctx: CorrelationContext) -> Result<ServiceResult<String>, ErrorResult> {
    Ok(HtmlServiceResult::ok("<h1>Hello</h1>"))
}

Structs§

HtmlServiceResult
Shortcut constructors for HTML handler results.