Image

public struct Image : HttpBody, Hashable

The image HTTP body can be used to attach an image to a request. Currently, only PNG and JPEG images are supported. When adding the image’s data to the body of the request, this body also sets the “Content-Type” header to the appropriate MIME type as well as the “Content-Length” header to the size of the image in bytes.

Initialization

  • Initializes a new HTTP image body.

    Declaration

    Swift

    public init(_ mime: HttpMimeType, data: Data)

    Parameters

    mime

    The MIME type of the image, i.e. of the given data.

    data

    The image’s data to set as the request’s body.

HttpBody

  • Declaration

    Swift

    public func add(to request: inout URLRequest) throws
  • Declaration

    Swift

    public var description: String { get }