HTTPHeaders (ext)
You’re viewing third-party extensions to HTTPHeaders
, a struct from swift-nio.
You can also read the documentation forHTTPHeaders
itself.
extension HTTPHeaders
You’re viewing third-party extensions to HTTPHeaders
, a struct from swift-nio.
You can also read the documentation forHTTPHeaders
itself.
extension HTTPHeaders
struct HTTPHeaders
A representation of a block of HTTP header fields.
import Vapor
Vapor is a framework for building server applications, APIs and websites in Swift. It provides a safe, performant and scalable foundation for building large complex backends.
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol Decodable
A type that can decode itself from an external representation.
protocol Encodable
A type that can encode itself to an external representation.
init(from decoder: any Decoder) throws
var accept: [HTTPMediaTypePreference] { get }
Returns a collection of MediaTypePreference
s specified by this HTTP message’s "Accept"
header.
var basicAuthorization: BasicAuthorization? { get set }
Access or set the Authorization: Basic: ...
header.
var bearerAuthorization: BearerAuthorization? { get set }
Access or set the Authorization: Bearer: ...
header.
var cacheControl: CacheControl? { get set }
Gets the value of the Cache-Control
header, if present.
var connection: Connection? { get set }
var contentDisposition: ContentDisposition? { get set }
Convenience for accessing the Content-Disposition header.
var contentRange: ContentRange? { get set }
Convenience for accessing the Content-Range response header.
var contentType: HTTPMediaType? { get set }
MediaType
specified by this message’s "Content-Type"
header.
var cookie: HTTPCookies? { get set }
Get and set HTTPCookies
for an HTTP request This accesses the "Cookie"
header.
var debugDescription: String { get }
See CustomDebugStringConvertible.debugDescription
var expires: Expires? { get set }
Gets the value of the Expires
header, if present.
var forwarded: [Forwarded] { get set }
Convenience for accessing the Forwarded header. This header is added by proxies to pass information about the original request.
var lastModified: LastModified? { get set }
var links: [Link]? { get set }
Convenience for accessing the Link header as an array of provided links.
var range: Range? { get set }
Convenience for accessing the Range
request header.
var responseCompression: ResponseCompression { get set }
A marker header internal to vapor that explicitely allows or disallows response compression.
var setCookie: HTTPCookies? { get set }
Get and set HTTPCookies
for an HTTP response This accesses the "Set-Cookie"
header.
subscript(name: Name) -> [String] { get }
Retrieve all of the values for a given header field name from the block.
subscript(canonicalForm name: Name) -> [Substring] { get }
mutating func add(name: Name, value: String)
Add a header name/value pair to the block.
func contains(name: Name) -> Bool
Returns true
if the HTTPHeaders
contains a value for the supplied name.
func encode(to encoder: any Encoder) throws
func expirationDate(requestSentAt: Date) -> Date?
Determines when the cached data should be expired.
func first(name: Name) -> String?
Returns the first header value with the supplied name.
mutating func remove(name: Name)
Remove all values for a given header name from the block.
mutating func replaceOrAdd(name: Name, value: String)
Add a header name/value pair to the block, replacing any previous values for the same header name that are already in the block.
struct CacheControl
Represents the HTTP Cache-Control
header.
struct Connection
struct ContentDisposition
struct ContentRange
Represents the HTTP Content-Range
response header.
struct Expires
struct Forwarded
Parses the Forwarded
header.
struct LastModified
Represents the HTTP Last-Modified
header.
struct Link
struct Name
Type used for the name of a HTTP header in the HTTPHeaders
storage.
struct Range
Represents the HTTP Range
request header. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Range
enum RangeUnit
The unit in which ContentRange
s and Range
s are specified. This is usually bytes
. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Range
struct ResponseCompression
A marker header internal to vapor that explicitely allows or disallows response compression.