aris 1.4.0 → 1.4.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: bf323ca0ed960b60c26e09f0b575212544c8c5b15b95be5e299b6296f03d97df
4
- data.tar.gz: a68dfcec5a685a815f069f960f9bdcf6462115d6f5758e4adbedaf3ddbe3b3fa
3
+ metadata.gz: 522385f073c3f854d6c1c257177a18cb47584eccde6c78bbd2f8f15a2252ec6a
4
+ data.tar.gz: 20d7625e69e21e364d790fa45393be6bce546783c061422d419e310c3d12dea1
5
5
  SHA512:
6
- metadata.gz: d42298b4ba003ec4d10494b9545e23fc381e037087720293e176e46a49446d9897c665a8dc3d4e684551193df7b2c07850f8743542b75718b7242b0bda816246
7
- data.tar.gz: b04ef54738e7f457ee594d83407f27a58b94b05c8d8c00c03106f9cfdaf950d3c58d0e153fdfe613d2e98f41a9216d10c93b84d9b9b5768e49474e9e40d283c2
6
+ metadata.gz: 3dc13fa33795500031ecf33ce8d83d2edee2b39914f707d8275f4f8dbe827a8bebd022394d5471b0f46a00a1c17c3c67a23e6f85c42af1497e0db2ed9deb2bd6
7
+ data.tar.gz: fbf7c8643a0b5a793ca5bb66ee0c3dc0ba1a2b2f83f09d393a9914e6b0a5bac262928273b1ff45c7270cf07ef455e5580d99b60ae7f875a55287654fd0042164
@@ -12,10 +12,9 @@ module Aris
12
12
  @config = config
13
13
  end
14
14
 
15
- def call(request, response)
15
+ def self.call(request, response)
16
16
  return nil unless PARSEABLE_METHODS.include?(request.method)
17
17
 
18
- # Check content-type - access from env, not headers
19
18
  content_type = request.env['CONTENT_TYPE']
20
19
  return nil unless content_type&.include?('application/x-www-form-urlencoded')
21
20
 
@@ -23,11 +22,14 @@ def call(request, response)
23
22
  return nil if raw_body.nil? || raw_body.empty?
24
23
 
25
24
  begin
26
- # Parse form data
27
25
  data = ::Rack::Utils.parse_nested_query(raw_body)
26
+ request.instance_variable_set(:@parsed_form_data, data)
27
+
28
+ # Add clean accessor method
29
+ request.define_singleton_method(:form_params) do
30
+ @parsed_form_data || {}
31
+ end
28
32
 
29
- # Attach parsed data to request
30
- request.instance_variable_set(:@form_data, data)
31
33
  rescue => e
32
34
  response.status = 400
33
35
  response.headers['content-type'] = 'text/plain'
@@ -35,7 +37,7 @@ def call(request, response)
35
37
  return response
36
38
  end
37
39
 
38
- nil # Continue pipeline
40
+ nil
39
41
  end
40
42
 
41
43
  def self.build(**config)
@@ -44,3 +46,4 @@ end
44
46
  end
45
47
  end
46
48
  end
49
+ Aris.register_plugin(:form_parser, plugin_class: Aris::Plugins::FormParser)
data/lib/aris/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Aris
2
- VERSION = "1.4.0"
2
+ VERSION = "1.4.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aris
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Garcia