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 +4 -4
- data/.gitignore +2 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/README.md +3 -4
- data/lib/bad_json_request_handler.rb +7 -0
- data/lib/bad_json_request_handler/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c94710c11861158f61e7ac66b107a642613335b0beab93651d62bd47d797892
|
4
|
+
data.tar.gz: d89b4604afe062c475977d28070460c30fa6d40166f4ccd10ae7de19b85d3f76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcdb2c282c91a49ed13955ea208914b0d5be5398a7409f677e64b7781ba2479e35f3deab6dbf9091f6e58907ceb9944acd55557394b2ccdb111c4a87f37c3977
|
7
|
+
data.tar.gz: 4b38c06cdbaa691334a2ceb9a258ac49611bbc10772d5dc454adf13be369e960569e5f73ccaa1466f6039335fa202baadb6612cf72e764491a9afd845666cb4d
|
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# BadJsonRequestHandler
|
2
2
|
|
3
|
-
|
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
|
-
|
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
|
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.
|
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-
|
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
|