Skip to content

BuildableRequest

[Source]

A HTTP Request that is created with trn refcap in order to be mutable, and then, when done, be consumed into a val reference. This is the way, the HTTP11RequestParser is handling this class and so should you.

class val BuildableRequest is
  Request val

Implements


Constructors

create

[Source]

new trn create(
  method': Method val = reference,
  uri': URL val = reference,
  version': ((HTTP09 val | HTTP10 val | HTTP11 val) & _Version val) = reference,
  transfer_coding': (Chunked val | None val) = reference,
  content_length': (USize val | None val) = reference)
: BuildableRequest trn^

Parameters

  • method': Method val = reference
  • uri': URL val = reference
  • version': ((HTTP09 val | HTTP10 val | HTTP11 val) & _Version val) = reference
  • transfer_coding': (Chunked val | None val) = reference
  • content_length': (USize val | None val) = reference

Returns


Public Functions

method

[Source]

The Request Method.

See: https://tools.ietf.org/html/rfc2616#section-5.1.1

fun box method()
: Method val

Returns


set_method

[Source]

fun ref set_method(
  method': Method val)
: BuildableRequest ref

Parameters

Returns


uri

[Source]

The request URI

See: https://tools.ietf.org/html/rfc2616#section-5.1.2

fun box uri()
: URL val

Returns


set_uri

[Source]

fun ref set_uri(
  uri': URL val)
: BuildableRequest ref

Parameters

  • uri': URL val

Returns


version

[Source]

The HTTP version as given on the Request Line.

See: https://tools.ietf.org/html/rfc2616#section-3.1 and https://tools.ietf.org/html/rfc2616#section-5.1

fun box version()
: ((HTTP09 val | HTTP10 val | HTTP11 val) & _Version val)

Returns


set_version

[Source]

fun ref set_version(
  v: ((HTTP09 val | HTTP10 val | HTTP11 val) & _Version val))
: BuildableRequest ref

Parameters

Returns


[Source]

Case insensitive lookup of header value in this request. Returns None if no header with name exists in this request.

fun box header(
  name: String val)
: (String val | None val)

Parameters

Returns


headers

[Source]

fun box headers()
: Iterator[(String val , String val)] ref

Returns


add_header

[Source]

Add a header with name and value to this request. If a header with this name already exists, the given value will be appended to it, with a separating comma.

fun ref add_header(
  name: String val,
  value: String val)
: BuildableRequest ref

Parameters

Returns


set_header

[Source]

Set a header in this request to the given value.

If a header with this name already exists, the previous value will be overwritten.

fun ref set_header(
  name: String val,
  value: String val)
: BuildableRequest ref

Parameters

Returns


clear_headers

[Source]

Remove all previously set headers from this request.

fun ref clear_headers()
: BuildableRequest ref

Returns


transfer_coding

[Source]

If Chunked the request body is encoded with Chunked Transfer-Encoding:

See: https://tools.ietf.org/html/rfc2616#section-3.6.1

If None, no Transfer-Encoding is applied. A Content-Encoding might be applied to the body.

fun box transfer_coding()
: (Chunked val | None val)

Returns


set_transfer_coding

[Source]

fun ref set_transfer_coding(
  te: (Chunked val | None val))
: BuildableRequest ref

Parameters

Returns


content_length

[Source]

The content-length of the body of the request, counted in number of bytes.

If the content-length is None, the request either has no content-length set or it's transfer-encoding is Chunked: https://tools.ietf.org/html/rfc2616#section-3.6.1

fun box content_length()
: (USize val | None val)

Returns


set_content_length

[Source]

fun ref set_content_length(
  cl: USize val)
: BuildableRequest ref

Parameters

Returns


has_body

[Source]

Returns true if either we have Chunked Transfer-Encoding or a given Content-Length. In those cases we can expect a body.

fun box has_body()
: Bool val

Returns