Skip to the content.

Response Headers

Auto-generated documentation for moona.http.response_headers module.

auto_content_length

[find in source code]

@handle_func_sync
def auto_content_length(ctx: HTTPContext) -> HTTPContext:

Sets “Content-Length” to current response body.

If body is None than 0 length is set.

Arguments

See also

content_length

[find in source code]

def content_length(value: int) -> HTTPHandler:

HTTPHandler that sets “Content-Length` response header.

Arguments

See also

content_type

[find in source code]

def content_type(value: str):

HTTPHandler that sets “Content-Type” response header.

Arguments

Returns

content_type_application_json

[find in source code]

def content_type_application_json(
    nxt: HTTPFunc,
    ctx: HTTPContext,
) -> future[HTTPContext | None]:

Sets “Content-Type: application/json” response header.

Arguments

Returns

future[HTTPContext None]: result

See also

content_type_text_plain

[find in source code]

def content_type_text_plain(
    nxt: HTTPFunc,
    ctx: HTTPContext,
) -> future[HTTPContext | None]:

Sets “Content-Type: text/plain” response header.

Arguments

Returns

future[HTTPContext None]: result.

See also

[find in source code]

@handler2
def header(
    name: str,
    value: str,
    nxt: HTTPFunc,
    ctx: HTTPContext,
) -> future[HTTPContext | None]:

HTTPHandler that sets response header.

Arguments

Returns

future[HTTPContext None]: result.

See also