Options
All
  • Public
  • Public/Protected
  • All
Menu

Class HttpHeaders

A collection of HTTP headers

Hierarchy

  • HttpHeaders

Implements

  • HttpHeaders

Index

Constructors

constructor

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

    Parameters

    Returns HttpHeaders

Properties

Readonly length

length: number

Methods

[Symbol.iterator]

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

    Returns Iterator<HttpHeader>

add

  • add(key: string, value: string): void
  • Add a name/value pair

    Parameters

    • key: string
    • value: string

      The header value

    Returns void

clear

  • clear(): void
  • Clears the entire header set

    Returns void

get

  • get(key: string): string
  • Gets the first value for the given name, ignoring any additional values

    Parameters

    • key: string

    Returns string

    The first header value, or default if no values exist

get_values

  • get_values(key: string): string[]
  • Get the list of values for the given name

    Parameters

    • key: string

    Returns string[]

    List of values, or empty list if none exist

remove

  • remove(key: string): void
  • Removes all values for the given name

    Parameters

    • key: string

    Returns void

remove_value

  • remove_value(key: string, value: string): void
  • Removes a specific name/value pair

    Parameters

    • key: string
    • value: string

      The header value to remove

    Returns void

set

  • set(key: string, value: string): void
  • Set a name/value pair, replacing any existing values for the name

    Parameters

    • key: string
    • value: string

      The header value

    Returns void

Generated using TypeDoc