Skip to content
This repository has been archived by the owner on Oct 17, 2021. It is now read-only.

URLEncodedFormParameterEncoder

mattt edited this page Sep 18, 2020 · 2 revisions

URLEncodedFormParameterEncoder

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.

open class URLEncodedFormParameterEncoder:​ ParameterEncoder

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.

Inheritance

ParameterEncoder

Initializers

init(encoder:​destination:​)

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

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

Parameters

  • encoder:​ The URLEncodedFormEncoder. URLEncodedFormEncoder() by default.
  • destination:​ The Destination. .methodDependent by default.

Properties

`default`

Returns an encoder with default parameters.

var `default`:​ URLEncodedFormParameterEncoder

encoder

The URLEncodedFormEncoder to use.

let encoder:​ URLEncodedFormEncoder

destination

The Destination for the URL-encoded string.

let destination:​ Destination

Methods

encode(_:​into:​)

open func encode<Parameters:​ Encodable>(_ parameters:​ Parameters?, into request:​ URLRequest) throws -> URLRequest
Types
Protocols
Global Typealiases
Clone this wiki locally