rack-contrib 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.

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
2
  SHA1:
3
- metadata.gz: 6e6fdc1793443b60b19d951c29f4454178c07e5e
4
- data.tar.gz: d3ef6b5dfd00f8c79c80fd24e7db42b9a90d8e88
3
+ metadata.gz: e3cea264a3b11a9fbb1007dffe003812fd158e17
4
+ data.tar.gz: 2ea55db6bc8035033498a3ef28eaf67a05e77d0e
5
5
  SHA512:
6
- metadata.gz: ce6c4cd334d41918b2004dfb034ced650ce6b9c9d5d50472776e3239fd1f1483266efa62afa28a3383b180f5a7fbd00a5fff9b7c8a36b57b5b71557d7552bc8e
7
- data.tar.gz: cefd817385ec17640810a98b4c46580ec4fe370f16c40a2464715dbe582dae52572e56d7b2bf5577affb2cf2792c5da703fb2b579a773b07b2f699a4d927587e
6
+ metadata.gz: 47ec0e780cc7f17442a259ca705f2f4195b697deea6a9846ff37444823306b2f713bf4f5b15ed646a2cdab4f18a367cca8a703d4691645507b2f4d91f423cd6d
7
+ data.tar.gz: 157cd41a8ba74f5872f7f4dae46c0234b2aea03babbe984d3c4278e1f9b78b466cd5341ff7602be217015234b62ea3a050a0e458f67369dd76e5a98c69c8fd44
@@ -34,7 +34,12 @@ module Rack
34
34
  env.update(FORM_HASH => JSON.parse(body, :create_additions => false), FORM_INPUT => env[POST_BODY])
35
35
  end
36
36
  @app.call(env)
37
+ rescue JSON::ParserError
38
+ bad_request('failed to parse body as JSON')
37
39
  end
38
40
 
41
+ def bad_request(body = 'Bad Request')
42
+ [ 400, { 'Content-Type' => 'text/plain', 'Content-Length' => body.size.to_s }, [body] ]
43
+ end
39
44
  end
40
45
  end
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: 1.5.0
4
+ version: 1.6.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-07-18 00:00:00.000000000 Z
11
+ date: 2017-08-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack