Skip to content

gufo.http.httpd

Httpd context manager for tests.

Httpd

Bases: object

Httpd test context manager.

Attributes:

Name Type Description
prefix

URL prefix.

Parameters:

Name Type Description Default
path Optional[str]

nginx binary path. Auto-detect if None.

None
address str

Listen address.

'127.0.0.1'
port int

Listen port.

10080
host str

Server hostname.

'local.gufolabs.com'
start_timeout float

Maximum time to wait for nginx to start.

5.0
check_config bool

Check nginx config on startup.

True
mode HttpdMode

HTTP or HTTPS

HTTP

__aenter__() async

Asynchronous context manager entry.

__aexit__(exc_type, exc_val, exc_tb) async

Asynchronous context manager exit.

__enter__()

Context manager entry.

__exit__(exc_type, exc_val, exc_tb)

Context manager exit.

expand_url(tpl)

Expand url template.

Replace:

  • {port} - server's port
  • {hostname} - current host's name.

get_config(prefix)

Generate nginx.conf.

HttpdMode

Bases: Enum

Httpd mode.

Attributes:

Name Type Description
HTTP

HTTP Mode.

HTTPS

HTTPS Mode.