Attention

This is the documentation for HARP Proxy, actually published as an early preview. Both the software and documentation are a work in progress, and although we already use it on various production servers, they may contain inaccuracies, typographical errors, huge mistakes and empty pages. We work hard to eradicate all mistakes and implement stuff, but it is a long and tedious process. We appreciate your patience and understanding. Of course, any help will be greatly appreciated.

harp.http.serializers

class BaseHttpMessageSerializer[source]

Bases: MessageSerializer

Base serializer for HTTP messages.

__init__(message)[source]
Parameters:

message (BaseHttpMessage)

property body: bytes
property headers: str
property summary: str
class HttpErrorSerializer[source]

Bases: BaseHttpMessageSerializer

Serialize an HTTP error object into string representations for different message parts:

  • summary: the error message

  • headers: empty

  • body: stack trace (xxx this may change, maybe too much info and too much internal)

The main goal of this serializer is to prepare an error message for storage.

property summary: str
wrapped: HttpError
class HttpRequestSerializer[source]

Bases: BaseHttpMessageSerializer

Serialize an HTTP request object into string representations for different message parts:

  • summary: the first line of the request message (e.g. “GET / HTTP/1.1”)

  • headers: the headers of the request message (e.g. “Host: localhost:4080

Connection: keep-alive …”)

  • body: the body of the request message (e.g. b’{“foo”: “bar”}’)

The main goal of this serializer is to prepare a request message for storage.

property summary: str
wrapped: HttpRequest
class HttpResponseSerializer[source]

Bases: BaseHttpMessageSerializer

Serialize an HTTP response object into string representations for different message parts:

  • summary: the first line of the response message (e.g. “HTTP/1.1 200 OK”)

  • headers: the headers of the response message (e.g. “Content-Type: text/plain

Content-Length: 13 …”)

  • body: the body of the response message (e.g. b’Hello, world!’)

The main goal of this serializer is to prepare a response message for storage.

property summary: str
wrapped: HttpResponse
get_serializer_for(message)[source]
Parameters:

message (BaseMessage)

Return type:

MessageSerializer