Aller au contenu principal

AxiosHeaders Class

Axios.Net › AxiosNet.Models

Case-insensitive header collection, modeled after axios' AxiosHeaders.

public class AxiosHeaders : System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, string>>, System.Collections.IEnumerable

Inheritance System.Object → AxiosHeaders

Implements System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String,System.String>>, System.Collections.IEnumerable

Constructors​

AxiosHeaders() Constructor​

Creates an empty collection.

public AxiosHeaders();

AxiosHeaders(IEnumerable<KeyValuePair<string,string>>) Constructor​

Creates a collection holding a copy of source.

public AxiosHeaders(System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,string>> source);

Parameters​

source System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String,System.String>>

The headers to copy.

Properties​

AxiosHeaders.Count Property​

Number of headers.

public int Count { get; }

Property Value​

System.Int32

AxiosHeaders.this[string] Property​

Gets a header (null when absent). Assigning null removes it.

public string? this[string name] { get; set; }

Parameters​

name System.String

Property Value​

System.String

Methods​

AxiosHeaders.Add(string, string) Method​

Enables collection initializers: new AxiosHeaders { { "Accept", "text/plain" } }.

public void Add(string name, string value);

Parameters​

name System.String

value System.String

AxiosHeaders.Clear() Method​

Removes every header.

public AxiosNet.Models.AxiosHeaders Clear();

Returns​

AxiosHeaders

AxiosHeaders.Clone() Method​

Returns a copy of this collection.

public AxiosNet.Models.AxiosHeaders Clone();

Returns​

AxiosHeaders

AxiosHeaders.Concat(AxiosHeaders[]) Method​

Returns a new instance holding this collection followed by others.

public AxiosNet.Models.AxiosHeaders Concat(params AxiosNet.Models.AxiosHeaders[] others);

Parameters​

others AxiosHeaders[]

Returns​

AxiosHeaders

AxiosHeaders.Delete(string) Method​

Removes a header and returns whether it was present.

public bool Delete(string name);

Parameters​

name System.String

Returns​

System.Boolean

AxiosHeaders.Get(string) Method​

Gets a header value, or null when absent.

public string? Get(string name);

Parameters​

name System.String

Returns​

System.String

AxiosHeaders.GetEnumerator() Method​

Enumerates the headers.

public System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<string,string>> GetEnumerator();

Implements GetEnumerator(), GetEnumerator()

Returns​

System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<System.String,System.String>>

AxiosHeaders.Has(string) Method​

True when the header is present.

public bool Has(string name);

Parameters​

name System.String

Returns​

System.Boolean

AxiosHeaders.Parse(string) Method​

Parses raw "Name: value" lines.

public static AxiosNet.Models.AxiosHeaders Parse(string raw);

Parameters​

raw System.String

Returns​

AxiosHeaders

AxiosHeaders.Set(string, string) Method​

Sets a header, replacing any previous value.

public AxiosNet.Models.AxiosHeaders Set(string name, string value);

Parameters​

name System.String

Header name, case-insensitive.

value System.String

Header value.

Returns​

AxiosHeaders

AxiosHeaders.Set(IEnumerable<KeyValuePair<string,string>>) Method​

Sets several headers, replacing any previous values.

public AxiosNet.Models.AxiosHeaders Set(System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,string>> headers);

Parameters​

headers System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String,System.String>>

The headers to set.

Returns​

AxiosHeaders

AxiosHeaders.ToJson() Method​

Plain dictionary copy, convenient for serialization.

public System.Collections.Generic.Dictionary<string,string> ToJson();

Returns​

System.Collections.Generic.Dictionary<System.String,System.String>

AxiosHeaders.ToString() Method​

Raw Name: value lines, one per header.

public override string ToString();

Returns​

System.String