HTTPHeaders

public struct HTTPHeaders

Representation of the HTTP headers associated with a HTTPRequest or HTTPResponse. Headers are subscriptable using case-insensitive comparison or provide Name constants. eg.

   let contentLength = headers["content-length"]

or

   let contentLength = headers[.contentLength]
  • Appends a header to the headers

    Declaration

    Swift

    public mutating func append(_ literal: HTTPHeaders.Literal)
  • Replaces a header in the headers

    Declaration

    Swift

    public mutating func replace(_ literal: HTTPHeaders.Literal)
  • Type used for the name of a HTTP header in the HTTPHeaders storage.

    See more

    Declaration

    Swift

    public struct Name: Hashable, ExpressibleByStringLiteral, CustomStringConvertible