HttpBody

public protocol HttpBody : CustomStringConvertible

The HttpBody protocol ought to be implemented by any entity that can attach data to the body of an HTTP request. Any entities implementing this protocol should be scoped in an extension of the HttpData enum.

  • Adds the body to the given request. The method also adds appropriate headers based on the HTTP body.

    Declaration

    Swift

    func add(to request: inout URLRequest) throws

    Parameters

    request

    The request to add the body to.

  • description Extension method

    The description is used for debugging purposes: whenever requests are printed, their body’s description is printed.

    Declaration

    Swift

    public var description: String { get }