bad_json_request_handler 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 828695f1714cfbe7b30d337e49e13e0a5c36dc7ac50866db054afe14c414611e
4
- data.tar.gz: ef2f2e806893faa54c2cfbb41763f4aca0883da79f8c4503f44ae09235e449cb
3
+ metadata.gz: 4c94710c11861158f61e7ac66b107a642613335b0beab93651d62bd47d797892
4
+ data.tar.gz: d89b4604afe062c475977d28070460c30fa6d40166f4ccd10ae7de19b85d3f76
5
5
  SHA512:
6
- metadata.gz: dbb14fa92d33257692854ab0539b597d261931318ca2058d6d3a974e9b17071000b4c1f4fce81d9a8d067e7ea51e42b3ba7b62df95dade75b0144f07046cf23a
7
- data.tar.gz: 8980908b61450051ac73a0dc21659137ae491f6710a1f0ea5752352efe28c155bc908969b98934422b1cca89133974b707195127f83ee3724eb1e83be6f7af09
6
+ metadata.gz: dcdb2c282c91a49ed13955ea208914b0d5be5398a7409f677e64b7781ba2479e35f3deab6dbf9091f6e58907ceb9944acd55557394b2ccdb111c4a87f37c3977
7
+ data.tar.gz: 4b38c06cdbaa691334a2ceb9a258ac49611bbc10772d5dc454adf13be369e960569e5f73ccaa1466f6039335fa202baadb6612cf72e764491a9afd845666cb4d
data/.gitignore CHANGED
@@ -6,3 +6,5 @@
6
6
  /pkg/
7
7
  /test/internal/log/*
8
8
  /tmp/
9
+ .idea
10
+ .ruby-version
@@ -0,0 +1,5 @@
1
+ 0.0.2
2
+ * Add a railtie to automatically include the middleware in the Rails app.
3
+
4
+ 0.0.1
5
+ * Initial release.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bad_json_request_handler (0.0.1)
4
+ bad_json_request_handler (0.0.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # BadJsonRequestHandler
2
2
 
3
- [![Gem Version][gem-version-img]][gem-url]
3
+ ![Gem Version][gem-version-img]
4
4
 
5
5
  You have a Rails API endpoint which expects JSON request payload. But some clients
6
6
  send invalid JSON requests.
@@ -42,12 +42,11 @@ Or install it yourself as:
42
42
 
43
43
  ## Usage
44
44
 
45
- Include this middleware in your Rails application by adding it to the middleware stack as follows.
45
+ This gem automatically includes `BadJsonRequestHandler` middleware in your Rails application
46
+ by adding it to the middleware stack as follows.
46
47
 
47
48
  ```rb
48
- # config/initializers/bad_json_request_handler.rb
49
49
  Rails.application.config.middleware.insert_after ActionDispatch::DebugExceptions, BadJsonRequestHandler::Middleware
50
-
51
50
  ```
52
51
  ## Development
53
52
 
@@ -1,6 +1,13 @@
1
+ require "rails/railtie"
1
2
  require "bad_json_request_handler/version"
2
3
 
3
4
  module BadJsonRequestHandler
5
+ class Railtie < ::Rails::Railtie
6
+ initializer 'railtie.configure_rails_initialization' do |app|
7
+ app.config.middleware.insert_after ActionDispatch::DebugExceptions, Middleware
8
+ end
9
+ end
10
+
4
11
  class Middleware
5
12
  def initialize(app)
6
13
  @app = app
@@ -1,3 +1,3 @@
1
1
  module BadJsonRequestHandler
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bad_json_request_handler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Prathamesh Sonpatki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-23 00:00:00.000000000 Z
11
+ date: 2020-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: combustion
@@ -34,6 +34,7 @@ files:
34
34
  - ".github/workflows/ruby.yml"
35
35
  - ".gitignore"
36
36
  - ".travis.yml"
37
+ - CHANGELOG.md
37
38
  - CODE_OF_CONDUCT.md
38
39
  - Gemfile
39
40
  - Gemfile.lock