jets 5.0.10 → 5.0.11

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: f5651514504b0be4ea5ca9eb26c21aba7fc5d0c9a820f1243c089baeb37ad0da
4
- data.tar.gz: 9b33a24aead4fa2eae801b0cb60dc4fe300410ecd968ac8f714b6ea71e131244
3
+ metadata.gz: e0f81036f4a6561d9a79f029ca1362a8f48ad234b5318d97126b4530aee2ea27
4
+ data.tar.gz: 1051b3344523c20ed370a2602b65de25c71d1bce50a5c7cb67ef9dcbcd97e190
5
5
  SHA512:
6
- metadata.gz: dddc6401aeedf0a081c1607bebb8115d7e710ca3c0ddd9da02ecb0010430bc8ae10f7cb8abb402b5817c309df3dc2d2aff24e2d57fd5d632b2957679c2e2a8d1
7
- data.tar.gz: a56b380644caccf47e8e962929f39b495b083bdacb66e91d97e0f1536415370172bbf41dd0b1589251e810e6e31655cedab50512dca88fa6843f1f8683759ff4
6
+ metadata.gz: f47b839cb9d3138c110d825a3936f0b823b7317e9f6559de1b199f64bad9820bd7716d04576f16ee27242a82e3090877967a6bc540dbe611afdd065e44deb8ff
7
+ data.tar.gz: a3bca9d28b17ce9a133b1a35bb01154e35601233ce9630172c5be15fe063e341df8af12d6a534628f8c022ac93093276bb879921e8b69d39b9dcc167cc34195b
data/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
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
+ ## [5.0.11] - 2024-03-20
7
+ - [#711](https://github.com/rubyonjets/jets/pull/711) Fix controller testing in jets 5 - handling of params and query
8
+ - [#715](https://github.com/rubyonjets/jets/pull/715) remove force_encoding that causes issues for international characters
9
+
6
10
  ## [5.0.10] - 2024-02-08
7
11
  - [#706](https://github.com/rubyonjets/jets/pull/706) permit YAML load of Date class
8
12
  - [#708](https://github.com/rubyonjets/jets/pull/708) Fix Prewarming
@@ -1,4 +1,4 @@
1
- require 'json'
1
+ require "json"
2
2
 
3
3
  # Hack AwsLambda Ruby Runtime to fix .to_json issue collision with ActiveSupport.
4
4
  # To reproduce:
@@ -18,24 +18,14 @@ module AwsLambda
18
18
  def marshall_response(method_response)
19
19
  case method_response
20
20
  when StringIO, IO
21
- [method_response, 'application/unknown']
21
+ [method_response, "application/unknown"]
22
22
  else
23
- # Orignal method calls .to_json but this collides with ActiveSupport's to_json
24
- # method_response.to_json # application/json is assumed
25
- # https://stackoverflow.com/questions/18067203/ruby-to-json-issue-with-error-illegal-malformed-utf-8
26
- if method_response.is_a?(Hash)
27
- method_response.deep_transform_values! do |v|
28
- if v.respond_to?(:force_encoding) && !v.frozen?
29
- v.force_encoding("ISO-8859-1").encode("UTF-8")
30
- else
31
- v # IE: Integer
32
- end
33
- end
34
- end
23
+ # Note: Removed previous code which did force_encoding("ISO-8859-1").encode("UTF-8")
24
+ # It caused issues with international characters.
25
+ # It does not seem like we need the force_encoding anymore.
35
26
  JSON.dump(method_response)
36
27
  end
37
28
  end
38
-
39
29
  end
40
30
  end
41
31
  end
@@ -16,19 +16,18 @@ module Jets::SpecHelpers
16
16
  attr_reader :request, :response
17
17
  def http_call(method:, path:, **options)
18
18
  headers = options.delete(:headers) || {}
19
+ params_hash = options.delete(:params) || options
19
20
  md = path.match(/\?(.*)/)
20
- query_string = md ? md[1] : ''
21
- query = Rack::Utils.parse_nested_query(query_string)
21
+ path = path.gsub("?#{md[1]}", '') if md
22
+ query = md ? Rack::Utils.parse_nested_query(md[1]).merge(params_hash) : params_hash
22
23
 
23
24
  params = Params.new
24
25
  if method.to_sym == :get
25
26
  params.body_params = {}
26
- params.query_params ||= options.delete(:params) || options
27
+ params.query_params = query || {}
27
28
  else
28
- params.body_params = options.delete(:body) || options.delete(:params) || options
29
+ params.body_params = options.delete(:body) || query
29
30
  end
30
- params.path_params = params.path_params
31
- params.query_params = query
32
31
 
33
32
  # Note: Do not cache the request object. Otherwise, it cannot be reused between specs.
34
33
  # See: https://community.rubyonjets.com/t/is-jets-spechelpers-controllers-request-being-cached/244/2
@@ -52,4 +51,4 @@ module Jets::SpecHelpers
52
51
  Jets.logger = old_logger
53
52
  end
54
53
  end
55
- end
54
+ end
data/lib/jets/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "5.0.10"
2
+ VERSION = "5.0.11"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jets
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.10
4
+ version: 5.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-08 00:00:00.000000000 Z
11
+ date: 2024-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer