Skip to content

HeaderCollection

Namespace: Vercel.AI.Util

public sealed class HeaderCollection

Case-insensitive header list that preserves repeated values such as Set-Cookie.

Inheritance: object

View source

public HeaderCollection()

Creates an empty collection.

View source

HeaderCollection(IEnumerable<KeyValuePair<string, string>>?)

Section titled “HeaderCollection(IEnumerable<KeyValuePair<string, string>>?)”
public HeaderCollection(IEnumerable<KeyValuePair<string, string>>? headers)

Copies <code class=“paramref”>headers</code>.

Parameters

Name Type Description
headers IEnumerable<KeyValuePair<string, string>>

View source

public void Add(string name, string value)

Appends one header value.

Parameters

Name Type Description
name string
value string

View source

public bool Contains(string name)

Returns whether a header with <code class=“paramref”>name</code> is present.

Parameters

Name Type Description
name string

Returns: bool

View source

public IReadOnlyList<KeyValuePair<string, string>> Entries()

Header entries in insertion order.

Returns: IReadOnlyList<KeyValuePair<string, string>>

View source

public string? Get(string name)

First value for <code class=“paramref”>name</code>, or null.

Parameters

Name Type Description
name string

Returns: string

View source

public IReadOnlyList<string> GetAll(string name)

Every value for <code class=“paramref”>name</code>.

Parameters

Name Type Description
name string

Returns: IReadOnlyList<string>

View source

Apache-2.0 · Copyright 2023 Vercel, Inc. · unofficial community port, not an official Vercel product