forked from shadowfacts/Tusker
Pachyderm: Fix request bodies form parameters not being percent-escaped
Fixes #65
This commit is contained in:
parent
afc2bfcf6b
commit
6831ab5385
|
@ -67,8 +67,11 @@ extension Parameter: CustomStringConvertible {
|
||||||
extension Array where Element == Parameter {
|
extension Array where Element == Parameter {
|
||||||
var urlEncoded: String {
|
var urlEncoded: String {
|
||||||
return compactMap {
|
return compactMap {
|
||||||
guard let value = $0.value else { return nil }
|
guard let value = $0.value,
|
||||||
return "\($0.name)=\(value)"
|
let escapedValue = value.addingPercentEncoding(withAllowedCharacters: .alphanumerics) else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return "\($0.name)=\(escapedValue)"
|
||||||
}.joined(separator: "&")
|
}.joined(separator: "&")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue