Back to Alamofire

URLEncodedFormParameterEncoder

docs/Classes/URLEncodedFormParameterEncoder.html

5.12.02.2 KB
Original Source

URLEncodedFormParameterEncoder

open class URLEncodedFormParameterEncoder : @unchecked Sendable, ParameterEncoder

A ParameterEncoder that encodes types as URL-encoded query strings to be set on the URL or as body data, depending on the Destination set.

If no Content-Type header is already set on the provided URLRequests, it will be set to application/x-www-form-urlencoded; charset=utf-8.

Encoding behavior can be customized by passing an instance of URLEncodedFormEncoder to the initializer.

`

                Destination
                `

Defines where the URL-encoded string should be set for each URLRequest.

See more

Declaration

Swift

public enum Destination

`

                default
                `

Returns an encoder with default parameters.

Declaration

Swift

public static var `default`: URLEncodedFormParameterEncoder { get }

`

                encoder
                `

The URLEncodedFormEncoder to use.

Declaration

Swift

public let encoder: URLEncodedFormEncoder

`

                destination
                `

The Destination for the URL-encoded string.

Declaration

Swift

public let destination: Destination

`

                init(encoder:destination:)
                `

Creates an instance with the provided URLEncodedFormEncoder instance and Destination value.

Declaration

Swift

public init(encoder: URLEncodedFormEncoder = URLEncodedFormEncoder(), destination: Destination = .methodDependent)

Parameters

| encoder |

The URLEncodedFormEncoder. URLEncodedFormEncoder() by default.

| | destination |

The Destination. .methodDependent by default.

|

`

                encode(_:into:)
                `

Declaration

Swift

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