HTTPMediaType

public struct HTTPMediaType
extension HTTPMediaType: Equatable
extension HTTPMediaType: CustomStringConvertible

Describes media types for the Content-Type HTTP header.

Also contains a number of default media types, defined according to: https://tools.ietf.org/html/rfc2045#section-5

Enum definitions

  • The identifier corresponding to type portion of a HTTP media type String.

    See more

    Declaration

    Swift

    public enum TypeIdentifier : String

Initialization

  • Initializes a HTTPMediaType based on various required and optional components.

    Declaration

    Swift

    public init(type: TypeIdentifier,
                subType: String,
                parameters: [String: String]? = nil)

    Parameters

    type

    The TypeIdentifier of the HTTP media type.

    subType

    The subtype String of the HTTP media type.

    parameters

    An optional Dictionary of additional parameters.

Public methods

  • The String representation of the receiver.

    Declaration

    Swift

    public func toString() -> String

    Return Value

    A String representation suitable for use as a HTTPHeader value string.

Default media type values

  • Undocumented

    Declaration

    Swift

    static let utf8CharsetParameter: [String : String]
  • any

    Undocumented

    Declaration

    Swift

    static let any: HTTPMediaType
  • Undocumented

    Declaration

    Swift

    static let binary: HTTPMediaType
  • Undocumented

    Declaration

    Swift

    static let bzip2: HTTPMediaType
  • Undocumented

    Declaration

    Swift

    static let gzip: HTTPMediaType
  • dtd

    Undocumented

    Declaration

    Swift

    static let dtd: HTTPMediaType
  • Undocumented

    Declaration

    Swift

    static let json: HTTPMediaType
  • Undocumented

    Declaration

    Swift

    static let jsonAPI: HTTPMediaType
  • pdf

    Undocumented

    Declaration

    Swift

    static let pdf: HTTPMediaType
  • tar

    Undocumented

    Declaration

    Swift

    static let tar: HTTPMediaType
  • Undocumented

    Declaration

    Swift

    static let urlEncodedForm: HTTPMediaType
  • xml

    Undocumented

    Declaration

    Swift

    static let xml: HTTPMediaType
  • zip

    Undocumented

    Declaration

    Swift

    static let zip: HTTPMediaType
  • Undocumented

    Declaration

    Swift

    static let audio: HTTPMediaType
  • Undocumented

    Declaration

    Swift

    static let midi: HTTPMediaType
  • mp3

    Undocumented

    Declaration

    Swift

    static let mp3: HTTPMediaType
  • wav

    Undocumented

    Declaration

    Swift

    static let wav: HTTPMediaType
  • ogg

    Undocumented

    Declaration

    Swift

    static let ogg: HTTPMediaType
  • gif

    Undocumented

    Declaration

    Swift

    static let gif: HTTPMediaType
  • Undocumented

    Declaration

    Swift

    static let jpeg: HTTPMediaType
  • png

    Undocumented

    Declaration

    Swift

    static let png: HTTPMediaType
  • svg

    Undocumented

    Declaration

    Swift

    static let svg: HTTPMediaType
  • Undocumented

    Declaration

    Swift

    static let multipartFormData: HTTPMediaType
  • Undocumented

    Declaration

    Swift

    static func multipartFormData(boundary: String) -> HTTPMediaType
  • css

    Undocumented

    Declaration

    Swift

    static let css: HTTPMediaType
  • Undocumented

    Declaration

    Swift

    static let html: HTTPMediaType
  • Undocumented

    Declaration

    Swift

    static let plainText: HTTPMediaType
  • avi

    Undocumented

    Declaration

    Swift

    static let avi: HTTPMediaType
  • Undocumented

    Declaration

    Swift

    static let mpeg: HTTPMediaType

Equatable conformance

  • Returns a Boolean value indicating whether two HTTPMediaType values are equal.

    Declaration

    Swift

    public static func == (lhs: `Self`, rhs: `Self`) -> Bool

    Parameters

    lhs

    A value to compare.

    rhs

    Another value to compare.

    Return Value

    true if the two media types are considered equal, and false otherwise.

CustomStringConvertible conformance

  • A string description of the HTTPMediaType.

    Declaration

    Swift

    public var description: String { get }