committee 5.5.1 → 5.5.2

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: c148e784d74f46205ffc12284b2caabbe9e61104e7ab608a57844b50db5af425
4
- data.tar.gz: 9660dc2a5d8f31425e257854fbeb115dacd3f1ba5d205ea1c7e6555c5a9d5c68
3
+ metadata.gz: 8c6653c3224887d3adf7300b4c4e2f047a839ab31ba1890b87b8daad828e939d
4
+ data.tar.gz: 7c00b24dff0a892dfe82b28304547e8ac47729f1ac87fcdf81f47575a7757bad
5
5
  SHA512:
6
- metadata.gz: 02e769c6ab664d13e651ac5577bc018615164f0cc047699c3f3245afd99f7cec5667606b613c9abdbc48eb7c8b012daf82279e07adb1dd642ef7920b452d73b4
7
- data.tar.gz: 9d9fb9fa77dae324e02890837b569395f94312dd70e815ce9d556e9d6075d58849fa7fef0785ccf4999e7fcb8022ce3cfff85fd3c689ca73e83591cf56b197c6
6
+ metadata.gz: 876a44d4c13020892a3e6b10ee1008fc0b5ee0d7e294acbca8922c5ec4cf7c78fe6bee6374388bc9468a4511b11eb68cf6e3c49bf360e77f158942953e113bcb
7
+ data.tar.gz: 17f3777d9d610fe64f86670c7b849a8dae18346ae5d59639b3bdd5cff2958649b1a6da78c5abe4d60e01dfd5a506fc2420f1c024de40d5f982bd2f353bf34d01
@@ -21,10 +21,11 @@ module Committee
21
21
  end
22
22
 
23
23
  def initialize(options = {})
24
- @allow_form_params = options[:allow_form_params]
25
- @allow_get_body = options[:allow_get_body]
26
- @allow_query_params = options[:allow_query_params]
27
- @optimistic_json = options[:optimistic_json]
24
+ @allow_form_params = options[:allow_form_params]
25
+ @allow_get_body = options[:allow_get_body]
26
+ @allow_query_params = options[:allow_query_params]
27
+ @allow_non_get_query_params = options[:allow_non_get_query_params]
28
+ @optimistic_json = options[:optimistic_json]
28
29
  end
29
30
 
30
31
  # return params and is_form_params
@@ -57,7 +58,15 @@ module Committee
57
58
  end
58
59
 
59
60
  def unpack_query_params(request)
60
- @allow_query_params ? self.class.indifferent_params(request.GET) : {}
61
+ unless @allow_query_params
62
+ return {}
63
+ end
64
+
65
+ if @allow_non_get_query_params
66
+ self.class.indifferent_params(request.params)
67
+ else
68
+ self.class.indifferent_params(request.GET)
69
+ end
61
70
  end
62
71
 
63
72
  def unpack_headers(request)
@@ -66,6 +66,7 @@ module Committee
66
66
  allow_form_params: validator_option.allow_form_params,
67
67
  allow_get_body: validator_option.allow_get_body,
68
68
  allow_query_params: validator_option.allow_query_params,
69
+ allow_non_get_query_params: validator_option.allow_non_get_query_params,
69
70
  optimistic_json: validator_option.optimistic_json,
70
71
  )
71
72
 
@@ -87,6 +87,7 @@ module Committee
87
87
  allow_form_params: validator_option.allow_form_params,
88
88
  allow_get_body: validator_option.allow_get_body,
89
89
  allow_query_params: validator_option.allow_query_params,
90
+ allow_non_get_query_params: validator_option.allow_non_get_query_params,
90
91
  optimistic_json: validator_option.optimistic_json,
91
92
  )
92
93
 
@@ -8,6 +8,7 @@ module Committee
8
8
  :allow_form_params,
9
9
  :allow_get_body,
10
10
  :allow_query_params,
11
+ :allow_non_get_query_params,
11
12
  :check_content_type,
12
13
  :check_header,
13
14
  :coerce_date_times,
@@ -37,6 +38,7 @@ module Committee
37
38
  @allow_blank_structures = options.fetch(:allow_blank_structures, false)
38
39
  @allow_form_params = options.fetch(:allow_form_params, true)
39
40
  @allow_query_params = options.fetch(:allow_query_params, true)
41
+ @allow_non_get_query_params = options.fetch(:allow_non_get_query_params, false)
40
42
  @check_content_type = options.fetch(:check_content_type, true)
41
43
  @check_header = options.fetch(:check_header, true)
42
44
  @coerce_recursive = options.fetch(:coerce_recursive, true)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Committee
4
- VERSION = '5.5.1'.freeze
4
+ VERSION = '5.5.2'.freeze
5
5
  end
@@ -99,6 +99,13 @@ describe Committee::RequestUnpacker do
99
99
  assert_equal({ "a" => "b" }, unpacker.unpack_query_params(request))
100
100
  end
101
101
 
102
+ it "unpacks query params from non-get requests with allow_non_get_query_params" do
103
+ env = { "rack.input" => StringIO.new(""), "REQUEST_METHOD" => "PUT", "QUERY_STRING" => "a=b" }
104
+ request = Rack::Request.new(env)
105
+ unpacker = Committee::RequestUnpacker.new({ allow_query_params: true, allow_non_get_query_params: true })
106
+ assert_equal({ "a" => "b" }, unpacker.unpack_query_params(request))
107
+ end
108
+
102
109
  it "errors if JSON is not an object" do
103
110
  env = { "CONTENT_TYPE" => "application/json", "rack.input" => StringIO.new('[2]'), }
104
111
  request = Rack::Request.new(env)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: committee
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.5.1
4
+ version: 5.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandur
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2025-02-06 00:00:00.000000000 Z
13
+ date: 2025-03-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json_schema