rack-contrib 2.0.1 → 2.1.0

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.

Potentially problematic release.


This version of rack-contrib might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7784c9ef2deb5524c67848eec58934752c586e8d
4
- data.tar.gz: 76bca1883c124f0c9143ef9b0d79cb550c261c03
2
+ SHA256:
3
+ metadata.gz: 0c7731ec4011969a7792a075037754884383bd79288d308f842db8d3566d69f9
4
+ data.tar.gz: 16ea5eb6e86c262eaf5382f7bd48d84a5d96f77730ef2afa3595da5ff63c01b7
5
5
  SHA512:
6
- metadata.gz: b9a70c52bcf05c8c56a11f7822e8b297feafcccd4cf67e80f21f3a5ea64116aab9db8a57e942c5eaea92825476fa7f1f9b7ad4b4133b1f8632e1a78f59f71f38
7
- data.tar.gz: bced2fb275258c226af75d670c6fac2eb5a2d10422ae0c9d9026f19330cf635dda62449e055923669a2c7495827ecb8035cdbcf849068e4a11f2ed46c980aa8d
6
+ metadata.gz: ba48f0a22d13513a34589c096b87fa836fd762799dd46a05ee17e0f8b07ec8bf41489aaf59e18f63c59f7c8d53bee10e9e2b1492fa7a5a12b70587f4eb644e46
7
+ data.tar.gz: ae7ca36ea51cfcb66053bd97baef862eb161f91fd08badce5283f05765263a354a2e9f5214e75ca4eb9f4fa5ad4505ad2a305d2899fca8d95736cd2fd847f945
data/README.md CHANGED
@@ -3,7 +3,6 @@
3
3
  This package includes a variety of add-on components for Rack, a Ruby web server
4
4
  interface:
5
5
 
6
- * `Rack::AcceptFormat` - Adds a format extension at the end of the URI when there is none, corresponding to the mime-type given in the Accept HTTP header.
7
6
  * `Rack::Access` - Limits access based on IP address
8
7
  * `Rack::Backstage` - Returns content of specified file if it exists, which makes it convenient for putting up maintenance pages.
9
8
  * `Rack::BounceFavicon` - Returns a 404 for requests to `/favicon.ico`
@@ -26,9 +25,8 @@ interface:
26
25
  * `Rack::ProcTitle` - Displays request information in process title (`$0`) for monitoring/inspection with ps(1).
27
26
  * `Rack::Profiler` - Uses ruby-prof to measure request time.
28
27
  * `Rack::RelativeRedirect` - Transforms relative paths in redirects to absolute URLs.
29
- * `Rack::ResponseCache` - Caches responses to requests without query strings to Disk or a user provider Ruby object. Similar to Rails' page caching.
28
+ * `Rack::ResponseCache` - Caches responses to requests without query strings to Disk or a user provided Ruby object. Similar to Rails' page caching.
30
29
  * `Rack::ResponseHeaders` - Manipulates response headers object at runtime
31
- * `Rack::Sendfile` - Enables `X-Sendfile` support for bodies that can be served from file.
32
30
  * `Rack::Signals` - Installs signal handlers that are safely processed after a request
33
31
  * `Rack::SimpleEndpoint` - Creates simple endpoints with routing rules, similar to Sinatra actions
34
32
  * `Rack::StaticCache` - Modifies the response headers to facilitiate client and proxy caching for static files that minimizes http requests and improves overall load times for second time visitors.
@@ -24,14 +24,15 @@ module Rack
24
24
  #
25
25
  APPLICATION_JSON = 'application/json'.freeze
26
26
 
27
- def initialize(app)
27
+ def initialize(app, &block)
28
28
  @app = app
29
+ @block = block || Proc.new { |body| JSON.parse(body, :create_additions => false) }
29
30
  end
30
31
 
31
32
  def call(env)
32
33
  if Rack::Request.new(env).media_type == APPLICATION_JSON && (body = env[POST_BODY].read).length != 0
33
34
  env[POST_BODY].rewind # somebody might try to read this stream
34
- env.update(FORM_HASH => JSON.parse(body, :create_additions => false), FORM_INPUT => env[POST_BODY])
35
+ env.update(FORM_HASH => @block.call(body), FORM_INPUT => env[POST_BODY])
35
36
  end
36
37
  @app.call(env)
37
38
  rescue JSON::ParserError
@@ -4,7 +4,10 @@ module Rack
4
4
  # Set the profile=process_time query parameter to download a
5
5
  # calltree profile of the request.
6
6
  #
7
- # Pass the :printer option to pick a different result format.
7
+ # Pass the :printer option to pick a different result format. Note that
8
+ # some printers (such as CallTreePrinter) have broken the
9
+ # `AbstractPrinter` API, and thus will not work. Bug reports to
10
+ # `ruby-prof`, please, not us.
8
11
  #
9
12
  # You can cause every request to be run multiple times by passing the
10
13
  # `:times` option to the `use Rack::Profiler` call. You can also run a
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-contrib
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - rack-devel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-08 00:00:00.000000000 Z
11
+ date: 2018-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -216,14 +216,14 @@ dependencies:
216
216
  requirements:
217
217
  - - "~>"
218
218
  - !ruby/object:Gem::Version
219
- version: 0.13.0
219
+ version: '0.17'
220
220
  type: :development
221
221
  prerelease: false
222
222
  version_requirements: !ruby/object:Gem::Requirement
223
223
  requirements:
224
224
  - - "~>"
225
225
  - !ruby/object:Gem::Version
226
- version: 0.13.0
226
+ version: '0.17'
227
227
  description: Contributed Rack Middleware and Utilities
228
228
  email: rack-devel@googlegroups.com
229
229
  executables: []
@@ -271,7 +271,7 @@ files:
271
271
  - lib/rack/contrib/static_cache.rb
272
272
  - lib/rack/contrib/time_zone.rb
273
273
  - lib/rack/contrib/try_static.rb
274
- homepage: http://github.com/rack/rack-contrib/
274
+ homepage: https://github.com/rack/rack-contrib/
275
275
  licenses:
276
276
  - MIT
277
277
  metadata: {}
@@ -297,7 +297,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
297
297
  version: '0'
298
298
  requirements: []
299
299
  rubyforge_project:
300
- rubygems_version: 2.6.13
300
+ rubygems_version: 2.7.7
301
301
  signing_key:
302
302
  specification_version: 2
303
303
  summary: Contributed Rack Middleware and Utilities