Table of Contents

THttpHeaders Class

A mutable collection of HTTP headers, keyed case-insensitively by header name.

Remarks

Header names are stored and matched in lower case, and values are trimmed of surrounding whitespace. Use SetValue to replace a header and AddValue to append to an existing one. Implements IReadOnlyHttpHeaders.

Syntax

Unit: Sparkle.Http.Headers

THttpHeaders = class(TInterfacedObject, IReadOnlyHttpHeaders);

Constructors

Name Description
Create Creates an empty header collection.

Methods

Name Description
AddValue Adds a value to the named header, appending it to any existing value using a comma or line feedseparator.
Clear Removes all headers from the collection.
Exists Indicates whether a header with the given name exists.
Get Returns the value of the named header, or an empty string if it does not exist.
GetIfExists Retrieves the value of the named header if it exists.
Remove Removes the named header if it exists.
SetValue Sets the named header to the given value, replacing any existing value.

Properties

Name Description
AllHeaders Gets an enumerable over all headers in the collection.
RawWideHeaders Gets or sets all headers as a single raw block of CRLF-separated name:value lines.