Request

class Request: HttpMessage
static source(source)

Construct a request from a source function

Parameters:

source (function) – (pat:string|number|nil):string|nil,nil|string

Returns:

request

Return type:

Request or nil

Returns:

error

Return type:

nil or str

static tcp_source(socket)

Create a new Request with a lua socket

Parameters:

socket (table) – tcp socket

Returns:

request with the first line parsed

Return type:

Request or nil

Returns:

if not nil an error message

Return type:

nil or str

static udp_source(socket)

Create a new Request with a lua socket

Parameters:

socket (table) – udp socket

Return type:

Request or nil

Return type:

nil or str

content_length()
static new(method, url, socket)

Construct a request Builder

Parameters:
  • method (str or nil) – an http method string

  • url (str or table or nil) – the path for this request as a string or as a net_url table

  • socket (table or nil) –

Return type:

Request