ParameterEncoder

public protocol ParameterEncoder : Sendable

A type that can encode any Encodable type into a URLRequest.

  • Encode the provided Encodable parameters into request.

    Throws

    An Error when encoding fails. For Alamofire provided encoders, this will be an instance of AFError.parameterEncoderFailed with an associated ParameterEncoderFailureReason.

    Declaration

    Swift

    func encode<Parameters>(_ parameters: Parameters?, into request: URLRequest) throws -> URLRequest where Parameters : Encodable, Parameters : Sendable

    Parameters

    parameters

    The Encodable parameter value.

    request

    The URLRequest into which to encode the parameters.

    Return Value

    A URLRequest with the result of the encoding.

Available where Self == JSONParameterEncoder

Available where Self == URLEncodedFormParameterEncoder