jets 4.0.2 → 4.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 898dace94ebd7b32151b27fa45377e873facc028dfd8a70545f9dd85a3aebf2b
4
- data.tar.gz: c91297479c8dd6dbe4a66edec38ff2fd3baefca8fc338300a349180935d1d8c3
3
+ metadata.gz: 2656b9ad4b3542399efbba9eadb992532d2ebed430315280d3e1524a376b3674
4
+ data.tar.gz: bcd37a34c13c7027b99854129cf537369dd357ba39edc7481416315d20137602
5
5
  SHA512:
6
- metadata.gz: a60f58645caf94956e029721d160954deadd0f6b826841f6178ba0d03b296ad8af13f6a88b376503e47a1e70c8486751d22cb432a03494ef03f9811176fbfc83
7
- data.tar.gz: e83434bf93f3f7d139877f2969a5b31fa85e5a49254a42c145e6eec728f3c0a47faaf3c5fe2a2e2c229d55202a149eddf273e93b365c018677e1d8dc967d4db7
6
+ metadata.gz: 4b16ac3cc3899c989c2de4670fbc6be7c2f9dc07b39869404ebbbc0689f458fc4befc699ccff3c14001946716288792077a006c97f9541f842040fa656e10a4b
7
+ data.tar.gz: d6f6f26ea83268b6ca877cfe8f49660e15b0e6709cfb7e498bbdf9b87cccf81b4c7cd86f2e707dd4ba0adbed0a8e70ccf0bd06cef80b15fb60e5b689b739dcbf
data/CHANGELOG.md CHANGED
@@ -3,6 +3,9 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/).
5
5
 
6
+ ## [4.0.3] - 2023-08-03
7
+ - [#657](https://github.com/boltops-tools/jets/pull/657) [Fix] ApiGateway for local Middleware: fix query_string_parameters
8
+
6
9
  ## [4.0.2] - 2023-08-03
7
10
  - [#660](https://github.com/boltops-tools/jets/pull/660) Fix prewarming
8
11
 
@@ -16,6 +16,7 @@ class Jets::Controller::Middleware::Local
16
16
  "httpMethod" => @env['REQUEST_METHOD'], # GET
17
17
  "headers" => request_headers,
18
18
  "queryStringParameters" => query_string_parameters,
19
+ "multiValueQueryStringParameters" => multi_value_query_string_parameters,
19
20
  "pathParameters" => @route.extract_parameters(path),
20
21
  "stageVariables" => nil,
21
22
  "requestContext" => {},
@@ -77,7 +78,18 @@ class Jets::Controller::Middleware::Local
77
78
  end
78
79
 
79
80
  def query_string_parameters
80
- Rack::Utils.parse_nested_query(@env['QUERY_STRING'])
81
+ @env['QUERY_STRING']&.split('&')&.each_with_object({}) do |parameter, hash|
82
+ key, value = parameter.split('=')
83
+ hash[key] = value
84
+ end || {}
85
+ end
86
+
87
+ def multi_value_query_string_parameters
88
+ @env['QUERY_STRING']&.split('&')&.each_with_object({}) do |parameter, hash|
89
+ key, value = parameter.split('=')
90
+ hash[key] = [] if hash[key].nil?
91
+ hash[key] << value
92
+ end || {}
81
93
  end
82
94
 
83
95
  # To get the post body:
@@ -112,9 +112,15 @@ module Jets::Controller::Rack
112
112
  end
113
113
 
114
114
  def query_string
115
- qs_params = @event["queryStringParameters"] || {} # always set with API Gateway but when testing node shim might not be
116
- hash = Jets::Mega::HashConverter.encode(qs_params)
117
- hash.to_query
115
+ qs_params = @event["multiValueQueryStringParameters"] || {} # always set with API Gateway but when testing node shim might not be
116
+
117
+ array = qs_params.each_with_object([]) do |(key, value), arr|
118
+ arr << value.map do |v|
119
+ v.to_query(key)
120
+ end
121
+ end
122
+
123
+ array.join("&")
118
124
  end
119
125
 
120
126
  def headers
@@ -7,7 +7,7 @@ module Jets::Mega
7
7
  value.each { |k,v| encode(v, append_key(key,k), out_hash) }
8
8
  out_hash
9
9
  when Array then
10
- value.each { |v| encode(v, "#{key}[]", out_hash) }
10
+ value.each { |v| encode(v, "#{key}", out_hash) }
11
11
  out_hash
12
12
  when nil then ''
13
13
  else
@@ -22,4 +22,4 @@ module Jets::Mega
22
22
  root_key.nil? ? :"#{key}" : :"#{root_key}[#{key.to_s}]"
23
23
  end
24
24
  end
25
- end
25
+ end
data/lib/jets/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "4.0.2"
2
+ VERSION = "4.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jets
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.2
4
+ version: 4.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen