Table of Contents

Class Headers

Namespace
Microsoft.Azure.Cosmos
Assembly
Microsoft.Azure.Cosmos.Client.dll

Header implementation used for Request and Responses

public class Headers : IEnumerable
Inheritance
Headers
Implements
Inherited Members
Extension Methods

Constructors

Headers()

Creates a new instance of Headers.

public Headers()
See Also

Properties

ActivityId

Gets the activity ID for the request from the Azure Cosmos DB service.

public virtual string ActivityId { get; }

Property Value

string

The activity ID for the request.

See Also

ContentLength

Gets the Content Length for the current content in the ResponseMessage.

public virtual string ContentLength { get; set; }

Property Value

string
See Also

ContentType

Gets the Content Type for the current content in the ResponseMessage.

public virtual string ContentType { get; }

Property Value

string
See Also

ContinuationToken

Gets the Continuation Token in the current ResponseMessage.

public virtual string ContinuationToken { get; }

Property Value

string
See Also

ETag

Gets the entity tag associated with the resource from the Azure Cosmos DB service.

public virtual string ETag { get; }

Property Value

string

The entity tag associated with the resource.

Remarks

ETags are used for concurrency checking when updating resources.

See Also

this[string]

Gets the value of a particular header.

public virtual string this[string headerName] { get; set; }

Parameters

headerName string

Header name to look for.

Property Value

string

The header value.

See Also

Location

Gets the Location for the current content in the ResponseMessage.

public virtual string Location { get; }

Property Value

string
See Also

RequestCharge

Gets the request charge for this request from the Azure Cosmos DB service.

public virtual double RequestCharge { get; }

Property Value

double

The request charge measured in request units.

See Also

Session

Gets the Session Token for the current ResponseMessage.

public virtual string Session { get; }

Property Value

string

Remarks

Session Token is used along with Session Consistency.

See Also

Methods

Add(string, IEnumerable<string>)

Adds a header to the Header collection.

public virtual void Add(string headerName, IEnumerable<string> values)

Parameters

headerName string

Header name.

values IEnumerable<string>

List of values to be added as a comma-separated list.

See Also

Add(string, string)

Adds a header to the Header collection.

public virtual void Add(string headerName, string value)

Parameters

headerName string

Header name.

value string

Header value.

See Also

AllKeys()

Obtains a list of all header names.

public virtual string[] AllKeys()

Returns

string[]

An array with all the header names.

See Also

Get(string)

Gets the value of a particular header.

public virtual string Get(string headerName)

Parameters

headerName string

Header name.

Returns

string

The header value.

See Also

GetEnumerator()

Enumerates all the HTTP headers names in the Headers.

public virtual IEnumerator<string> GetEnumerator()

Returns

IEnumerator<string>

An enumerator for all headers.

See Also

GetHeaderValue<T>(string)

Gets a header value with a particular type.

public virtual T GetHeaderValue<T>(string headerName)

Parameters

headerName string

Header name.

Returns

T

The header value parsed for a particular type.

Type Parameters

T

Type of the header value.

See Also

GetValueOrDefault(string)

Returns the header value or the default(string)

public virtual string GetValueOrDefault(string headerName)

Parameters

headerName string

Header Name

Returns

string

Returns the header value or the default(string).

See Also

Remove(string)

Removes a header from the header collection.

public virtual void Remove(string headerName)

Parameters

headerName string

Header name.

See Also

Set(string, string)

Adds or updates a header in the Header collection.

public virtual void Set(string headerName, string value)

Parameters

headerName string

Header name.

value string

Header value.

See Also

TryGetValue(string, out string)

Tries to get the value for a particular header.

public virtual bool TryGetValue(string headerName, out string value)

Parameters

headerName string

Header name.

value string

Header value.

Returns

bool

True or false if the header name existed in the header collection.

See Also

See Also