class documentation

class Response: (source)

View In Hierarchy

Metadata about an HTTP response, with an object that Klein knows how to understand.

This includes:

  • an HTTP response code
  • some HTTP headers
  • a body object, which can be anything else Klein understands; for example, an IResource, an IRenderable, str, bytes, etc.
Present Since
Klein NEXT
Instance Variable body Undocumented
Instance Variable code Undocumented
Instance Variable headers Undocumented
Method _applyToRequest Apply this Response to the given IRequest, setting its response code and headers.
body: Any = (source)

Undocumented

code: int = (source)

Undocumented

headers: Mapping[Union[str, bytes], Union[str, bytes, Sequence[Union[str, bytes]]]] = (source)

Undocumented

def _applyToRequest(self, request): (source)

Apply this Response to the given IRequest, setting its response code and headers.

Private because:

  • this should only ever be applied by Klein, and
  • hopefully someday soon this will be replaced with something that actually creates a txrequest-style response object.
Parameters
request:IRequestUndocumented
Returns
AnyUndocumented