HttpRespondWithHtml
Description
Populate response as an HTML reply. The body is a deep copy of html allocated through response->allocator.
Success
Returns response with status_code, content_type, and body updated.
Failure
Does not return - aborts on NULL arguments.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Http.c:41:
Str body = StrInit(alloc_base);
StrWriteFmt(&body, "<h1>hi</h1>");
HttpRespondWithHtml(&response, HTTP_RESPONSE_CODE_OK, &body);
StrDeinit(&body);- In
Http.c:382:
// ---------------------------------------------------------------------------
HttpResponse *HttpRespondWithHtml(HttpResponse *response, HttpResponseCode status, const Str *html) {
if (!response || !response->allocator || !html) {
LOG_FATAL("invalid arguments");
Last updated on