Skip to content

Commit b82eb44

Browse files
dppeakquickthyme
authored andcommitted
fixed double encoding of bracket url param
Signed-off-by: Quickthyme <[email protected]>
1 parent ab1c033 commit b82eb44

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/WebRequest/WebRequest+URLEncoder.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ extension WebRequest : URLEncoder {
2121
}
2222

2323
static func urlEncode(string: String) -> String {
24-
let allowed1 = CharacterSet(charactersIn: "-._~/?@")
24+
let allowed1 = CharacterSet(charactersIn: "-._~/?@[]")
2525
let allowed2 = CharacterSet.alphanumerics
2626
return string.addingPercentEncoding(withAllowedCharacters: allowed1.union(allowed2)) ?? ""
2727
}
@@ -35,7 +35,7 @@ extension WebRequest : URLEncoder {
3535
}
3636

3737
static func urlFormEncode(string: String) -> String {
38-
let allowed1 = CharacterSet(charactersIn: "*-._@ ")
38+
let allowed1 = CharacterSet(charactersIn: "*-._@[] ")
3939
let allowed2 = CharacterSet.alphanumerics
4040
return (string.addingPercentEncoding(withAllowedCharacters: allowed1.union(allowed2)) ?? "")
4141
.replacingOccurrences(of: " ", with: "+")

0 commit comments

Comments
 (0)