A collection of HTTP headers

Hierarchy

  • HttpHeaders

Implements

Constructors

  • Construct from a collection of [name, value] pairs

    Parameters

    • headers: HttpHeader[] = []

      list of HttpHeader values to seat in this object

    Returns HttpHeaders

Accessors

  • get length(): number
  • Fetches the total length of all headers

    Returns number

    the total length of all headers

Methods

  • Iterator. Allows for: let headers = new HttpHeaders(); ... for (const header of headers) { }

    Returns Generator<HttpHeader, void, unknown>

  • Add a name/value pair

    Parameters

    • name: string

      The header name

    • value: string

      The header value

    Returns void

  • Clears the entire header set

    Returns void

  • Gets the first value for the given name, ignoring any additional values

    Parameters

    • name: string

      The header name to look for

    • default_value: string = ""

      Value returned if no values are found for the given name

    Returns string

    The first header value, or default if no values exist

  • Get the list of values for the given name

    Parameters

    • name: string

      The header name to look for

    Returns string[]

    List of values, or empty list if none exist

  • Removes all values for the given name

    Parameters

    • name: string

      The header to remove all values for

    Returns void

  • Removes a specific name/value pair

    Parameters

    • name: string

      The header name to remove

    • value: string

      The header value to remove

    Returns void

  • Set a name/value pair, replacing any existing values for the name

    Parameters

    • name: string

      The header name

    • value: string

      The header value

    Returns void

Generated using TypeDoc