httpcore/httplogue

Types

ResponseHeaders = object
  table: TableRef[string, seq[string]]
  Source Edit

Procs

proc clear(headers: ResponseHeaders) {...}{.inline, raises: [], tags: [].}
  Source Edit
proc `[]=`(headers: ResponseHeaders; key, value: string) {...}{.inline, raises: [],
    tags: [].}
Sets the header entries associated with key to the specified value. Replaces any existing values.   Source Edit
proc `[]=`(headers: ResponseHeaders; key: string; value: seq[string]) {...}{.inline,
    raises: [], tags: [].}

Sets the header entries associated with key to the specified list of values. Replaces any existing values.

If value is an empty sequence, the key will be removed from headers.

  Source Edit
proc add(headers: ResponseHeaders; key, value: string) {...}{.inline,
    raises: [KeyError], tags: [].}
Adds the specified value to the specified key. Appends to any existing values associated with the key.   Source Edit
proc del(headers: ResponseHeaders; key: string) {...}{.inline, raises: [], tags: [].}
Delete the header entries associated with key   Source Edit

Funcs

func getTables(headers: ResponseHeaders): TableRef[string, seq[string]] {...}{.
    inline, raises: [], tags: [].}
Only for internal use, don't use it!   Source Edit
func initResponseHeaders(): ResponseHeaders {...}{.inline, raises: [], tags: [].}
Returns a new ResponseHeaders object.   Source Edit
func initResponseHeaders(keyValuePairs: openArray[
    tuple[key: string, val: string]]): ResponseHeaders {...}{.raises: [KeyError],
    tags: [].}
Returns a new ResponseHeaders object from an array.   Source Edit
func `$`(headers: ResponseHeaders): string {...}{.inline, raises: [], tags: [].}
  Source Edit
func `[]`(headers: ResponseHeaders; key: string): seq[string] {...}{.inline,
    raises: [KeyError], tags: [].}

Returns the values associated with the given key. If there are no values associated with the key, an exception is raised.

To access multiple values of a key, use the overloaded [] below or to get all of them access the table field directly.

  Source Edit
func `[]`(headers: ResponseHeaders; key: string; i: int): string {...}{.inline,
    raises: [KeyError], tags: [].}
Returns the i'th value associated with the given key. If there are no values associated with the key or the i'th value doesn't exist, an exception is raised.   Source Edit
func hasKey(headers: ResponseHeaders; key: string): bool {...}{.inline, raises: [],
    tags: [].}
  Source Edit
func getOrDefault(headers: ResponseHeaders; key: string; default = @[""]): seq[
    string] {...}{.inline, raises: [KeyError], tags: [].}
Returns the values associated with the given key. If there are no values associated with the key, then default is returned.   Source Edit
func len(headers: ResponseHeaders): int {...}{.inline, raises: [], tags: [].}
  Source Edit

Iterators

iterator pairs(headers: ResponseHeaders): tuple[key, value: string] {...}{.
    raises: [], tags: [].}
Yields each key, value pair.   Source Edit