|
2 | 2 | //
|
3 | 3 | // This source file is part of the Hummingbird server framework project
|
4 | 4 | //
|
5 |
| -// Copyright (c) 2021-2024 the Hummingbird authors |
| 5 | +// Copyright (c) 2021-2025 the Hummingbird authors |
6 | 6 | // Licensed under Apache License v2.0
|
7 | 7 | //
|
8 | 8 | // See LICENSE.txt for license information
|
@@ -33,19 +33,16 @@ where Responder.Context: InitializableFromSource<LambdaRequestContextSource<APIG
|
33 | 33 | // conform `APIGatewayRequest` to `APIRequest` so we can use Request.init(context:application:from)
|
34 | 34 | extension APIGatewayRequest: APIRequest {
|
35 | 35 | var queryString: String {
|
36 |
| - func urlPercentEncoded(_ string: String) -> String { |
37 |
| - return string.addingPercentEncoding(withAllowedCharacters: .urlQueryComponentAllowed) ?? string |
38 |
| - } |
39 | 36 | var queryParams: [String] = []
|
40 | 37 | var queryStringParameters = self.queryStringParameters
|
41 | 38 | // go through list of multi value query string params first, removing any
|
42 | 39 | // from the single value list if they are found in the multi value list
|
43 | 40 | for (key, value) in self.multiValueQueryStringParameters {
|
44 | 41 | queryStringParameters[key] = nil
|
45 |
| - queryParams += value.map { "\(urlPercentEncoded(key))=\(urlPercentEncoded($0))" } |
| 42 | + queryParams += value.map { "\(key.addingPercentEncoding(forURLComponent: .query))=\($0.addingPercentEncoding(forURLComponent: .query))" } |
46 | 43 | }
|
47 | 44 | queryParams += queryStringParameters.map {
|
48 |
| - "\(urlPercentEncoded($0.key))=\(urlPercentEncoded($0.value))" |
| 45 | + "\($0.key.addingPercentEncoding(forURLComponent: .query))=\($0.value.addingPercentEncoding(forURLComponent: .query))" |
49 | 46 | }
|
50 | 47 | return queryParams.joined(separator: "&")
|
51 | 48 | }
|
|
0 commit comments