JSONParameterEncoder
open class JSONParameterEncoder : @unchecked Sendable, ParameterEncoder
A ParameterEncoder that encodes types as JSON body data.
If no Content-Type header is already set on the provided URLRequests, it’s set to application/json.
-
Returns an encoder with default parameters.
Declaration
Swift
public static var `default`: JSONParameterEncoder { get } -
Returns an encoder with
JSONEncoder.outputFormattingset to.prettyPrinted.Declaration
Swift
public static var prettyPrinted: JSONParameterEncoder { get } -
Returns an encoder with
JSONEncoder.outputFormattingset to.sortedKeys.Declaration
Swift
@available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *) public static var sortedKeys: JSONParameterEncoder { get } -
JSONEncoderused to encode parameters.Declaration
Swift
public let encoder: JSONEncoder -
Creates an instance with the provided
JSONEncoder.Declaration
Swift
public init(encoder: JSONEncoder = JSONEncoder())Parameters
encoderThe
JSONEncoder.JSONEncoder()by default. -
Declaration
Swift
open func encode<Parameters: Encodable>(_ parameters: Parameters?, into request: URLRequest) throws -> URLRequest
View on GitHub
Install in Dash