morpheus.utils.http_utils.HttpParseResponse

class HttpParseResponse(status_code, content_type, body, on_complete_callback=None)[source]

Bases: NamedTuple

A tuple consisting of the HTTP status code, mime type to be used for the Content-Type header, the body of the response and an optional callback function to be invoked once the response is completed.

The values for status_code and content_type are strings rather than http.HTTPStatus and MimeTypes because these are intended to be consumed directly by the C++ implementation of morpheus.common.HttpServer. Instead these enums should be used to construct HttpParseResponse instances:

Copy
Copied!
            

>>> http_parse_response = HttpParseResponse(status_code=HTTPStatus.OK.value, ... content_type=MimeTypes.TEXT.value, ... body="OK", ... on_complete_callback=None) >>>

Attributes
body

Alias for field number 2

content_type

Alias for field number 1

on_complete_callback

Alias for field number 3

status_code

Alias for field number 0

Methods

count(value, /) Return number of occurrences of value.
index(value[, start, stop]) Return first index of value.
body: str

Alias for field number 2

content_type: str

Alias for field number 1

count(value, /)

Return number of occurrences of value.

index(value, start=0, stop=sys.maxsize, /)

Return first index of value.

Raises ValueError if the value is not present.

on_complete_callback: Optional[Callable[[bool, str], None]]

Alias for field number 3

status_code: int

Alias for field number 0

Previous morpheus.utils.http_utils.HTTPMethod
Next morpheus.utils.http_utils.MimeTypes
© Copyright 2024, NVIDIA. Last updated on Apr 25, 2024.