Skip to content

Commit a19dbe0

Browse files
committed
fix: use rfc3986Unreserved for url encoding
1 parent 38de4b9 commit a19dbe0

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

templates/apple/Sources/Client.swift.twig

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ import AsyncHTTPClient
99
let DASHDASH = "--"
1010
let CRLF = "\r\n"
1111

12+
extension CharacterSet {
13+
static let rfc3986Unreserved = CharacterSet(charactersIn: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~")
14+
}
15+
1216
open class Client {
1317

1418
// MARK: Properties
@@ -214,7 +218,7 @@ open class Client {
214218
}
215219

216220
return output.addingPercentEncoding(
217-
withAllowedCharacters: .urlHostAllowed
221+
withAllowedCharacters: .rfc3986Unreserved
218222
) ?? ""
219223
}
220224

templates/swift/Sources/Client.swift.twig

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ import AsyncHTTPClient
99
let DASHDASH = "--"
1010
let CRLF = "\r\n"
1111

12+
extension CharacterSet {
13+
static let rfc3986Unreserved = CharacterSet(charactersIn: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~")
14+
}
15+
1216
open class Client {
1317

1418
// MARK: Properties
@@ -191,7 +195,7 @@ open class Client {
191195
}
192196

193197
return output.addingPercentEncoding(
194-
withAllowedCharacters: .urlHostAllowed
198+
withAllowedCharacters: .rfc3986Unreserved
195199
) ?? ""
196200
}
197201

0 commit comments

Comments
 (0)