Key
public struct Key : ExpressibleByStringLiteral, Equatable, Hashable, CustomStringConvertible
A RequestHeaders.Key
is a value type used to describe keys in a header dictionary.
You can create headers in a few ways:
- Using any type that conforms to
RawRepresentable
whereRawValue
isString
- Using any type that conforms to
CustomStringConvertible
- Using strings or string literals
Commonly used values and additional factory methods are declared in an extension to reduce boilerplate and increase type safety.
-
Create a
Key
from aCustomStringConvertible
Declaration
Swift
public init<T>(_ value: T) where T : CustomStringConvertible
Parameters
value
The string convertible value
-
Create a
Key
from aRawRepresentable
Declaration
Swift
public init<T>(_ value: T) where T : RawRepresentable, T.RawValue == String
Parameters
value
The raw representable value
-
Create a
Key
from aString
Declaration
Swift
public init(_ value: String)
Parameters
value
The string
-
Declaration
Swift
public typealias StringLiteralType = String
-
Declaration
Swift
public init(stringLiteral value: StringLiteralType)
-
Declaration
Swift
public func hash(into hasher: inout Hasher)
-
Declaration
Swift
public static func == (lhs: Key, rhs: Key) -> Bool
-
Declaration
Swift
public let description: String
-
The
Accept
headerDeclaration
Swift
static let acceptType: RequestHeaders.Key
-
The
Accept-Encoding
headerDeclaration
Swift
static let acceptEncoding: RequestHeaders.Key
-
The
Accept-Language
headerDeclaration
Swift
static let acceptLanguage: RequestHeaders.Key
-
The
Authorization
headerDeclaration
Swift
static let authorization: RequestHeaders.Key
-
The
Content-Type
headerDeclaration
Swift
static let contentType: RequestHeaders.Key
-
The
Cache-Control
headerDeclaration
Swift
static let cacheControl: RequestHeaders.Key
-
The
Content-Disposition
headerDeclaration
Swift
static let contentDisposition: RequestHeaders.Key
-
The
Content-Length
headerDeclaration
Swift
static let contentLength: RequestHeaders.Key
-
The
Host
headerDeclaration
Swift
static let host: RequestHeaders.Key
-
The
Location
headerDeclaration
Swift
static let location: RequestHeaders.Key
-
The
Origin
headerDeclaration
Swift
static let origin: RequestHeaders.Key
-
The
Referer
headerDeclaration
Swift
static let referer: RequestHeaders.Key
-
The
User-Agent
headerDeclaration
Swift
static let userAgent: RequestHeaders.Key