We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 02207d1 commit 154d93dCopy full SHA for 154d93d
Sources/HandySwift/Types/RESTClient.swift
@@ -79,13 +79,13 @@ public final class RESTClient: Sendable {
79
}
80
81
82
- func httpData() throws -> Data {
+ func httpData(jsonEncoder: JSONEncoder) throws -> Data {
83
switch self {
84
case .binary(let data):
85
return data
86
87
case .json(let json):
88
- return try JSONEncoder().encode(json)
+ return try jsonEncoder.encode(json)
89
90
case .string(let string):
91
return Data(string.utf8)
@@ -164,7 +164,7 @@ public final class RESTClient: Sendable {
164
165
if let body {
166
do {
167
- request.httpBody = try body.httpData()
+ request.httpBody = try body.httpData(jsonEncoder: self.jsonEncoder)
168
} catch {
169
throw RequestError.failedToEncodeBody(error, self.errorContext(requestContext: errorContext))
170
0 commit comments