A Header represents the key-value pairs in an HTTP header.

The keys should be in canonical form, as returned by [CanonicalHeaderKey].

Hierarchy

Methods

  • Add adds the key, value pair to the header. It appends to any existing values associated with key. The key is case insensitive; it is canonicalized by [CanonicalHeaderKey].

    Parameters

    • key: string
    • value: string

    Returns void

  • Del deletes the values associated with key. The key is case insensitive; it is canonicalized by [CanonicalHeaderKey].

    Parameters

    • key: string

    Returns void

  • Get gets the first value associated with the given key. If there are no values associated with the key, Get returns "". It is case insensitive; [textproto.CanonicalMIMEHeaderKey] is used to canonicalize the provided key. Get assumes that all keys are stored in canonical form. To use non-canonical keys, access the map directly.

    Parameters

    • key: string

    Returns string

  • Set sets the header entries associated with key to the single element value. It replaces any existing values associated with key. The key is case insensitive; it is canonicalized by [textproto.CanonicalMIMEHeaderKey]. To use non-canonical keys, assign to the map directly.

    Parameters

    • key: string
    • value: string

    Returns void

  • Values returns all values associated with the given key. It is case insensitive; [textproto.CanonicalMIMEHeaderKey] is used to canonicalize the provided key. To use non-canonical keys, access the map directly. The returned slice is not a copy.

    Parameters

    • key: string

    Returns string[]

  • WriteSubset writes a header in wire format. If exclude is not nil, keys where exclude[key] == true are not written. Keys are not canonicalized before checking the exclude map.

    Parameters

    Returns void

Generated using TypeDoc