rambulance 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/lib/rambulance/exceptions_app.rb +6 -0
- data/lib/rambulance/version.rb +1 -1
- data/test/requests/error_json_test.rb +22 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82265aa18e23300634878ce073d6b72effb62a3a8326832f603d9b17b7640634
|
4
|
+
data.tar.gz: 67abe21526c25ab05b2faada53dbadafd62bf414638752cdec3450256e326e3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97932a0989390b458d8b697cb3be797f0441b623898a34d03e1920ff50f1d298b6ec5c03650b63adf6191a18ed22e66efda0c71686022691e48dab3cd5bcc836
|
7
|
+
data.tar.gz: 2af8602230f377774c17cb1f2ce0e1861a28880f7e5682807d135772fb51d9f69c8613f772866b082efccdfc8e5158971acfeedce16bbfb95c24afc812d77053
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
## v1.1.1 (unreleased)
|
2
|
+
|
3
|
+
- Fixes a bug where a malformed `Content-Type` header could break the exceptions app (#55, @gingerlime)
|
4
|
+
|
5
|
+
## [v1.1.0](https://github.com/yuki24/rambulance/tree/v1.1.0)
|
6
|
+
|
7
|
+
_<sup>released at 2020-05-23 02:52:27 UTC</sup>_
|
8
|
+
|
9
|
+
#### Features
|
10
|
+
|
11
|
+
- Add support for Ruby 2.7 ([<tt>718531c</tt>](https://github.com/yuki24/rambulance/commit/718531c45b61d01dce91f401fd81dd6aefdefb31))
|
12
|
+
|
13
|
+
#### Bug fixes
|
14
|
+
|
15
|
+
- Fixes a bug where malformed MIME type in HTTP headers could break the exceptions app ([#53](https://github.com/yuki24/rambulance/issues/53), [#54](https://github.com/yuki24/rambulance/pull/54), [@gingerlime](https://github.com/gingerlime))
|
16
|
+
|
1
17
|
## [v1.0.3](https://github.com/yuki24/rambulance/tree/v1.0.3)
|
2
18
|
|
3
19
|
_<sup>released at 2019-10-03 03:39:17 UTC</sup>_
|
@@ -55,6 +55,12 @@ module Rambulance
|
|
55
55
|
private
|
56
56
|
|
57
57
|
def process_action(*)
|
58
|
+
begin
|
59
|
+
request.content_mime_type
|
60
|
+
rescue Mime::Type::InvalidMimeType
|
61
|
+
request.env["MALFORMED_CONTENT_TYPE"], request.env["CONTENT_TYPE"] = request.env["CONTENT_TYPE"], "text/plain"
|
62
|
+
end
|
63
|
+
|
58
64
|
begin
|
59
65
|
request.GET
|
60
66
|
rescue ActionController::BadRequest
|
data/lib/rambulance/version.rb
CHANGED
@@ -55,6 +55,25 @@ class ErrorJsonTest < ActionDispatch::IntegrationTest
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
+
test 'returns an appropriate status based on the rails version when the HTTP Content-type header is malformed' do
|
59
|
+
if Rails::VERSION::STRING >= '5.1.0'
|
60
|
+
post '/users', headers: { "CONTENT_TYPE" => "charset=gbk" }
|
61
|
+
else
|
62
|
+
post '/users', nil, "CONTENT_TYPE" => "charset=gbk"
|
63
|
+
end
|
64
|
+
|
65
|
+
if Rails::VERSION::STRING >= '6.0.0'
|
66
|
+
assert_equal 406, response.status
|
67
|
+
assert_equal "The requested content type is not acceptable.\n", response.body
|
68
|
+
elsif Rails::VERSION::STRING >= '5.2.0'
|
69
|
+
assert_equal 422, response.status
|
70
|
+
elsif Rails::VERSION::STRING >= '5.1.0'
|
71
|
+
assert_equal 500, response.status
|
72
|
+
elsif Rails::VERSION::STRING >= '4.2.0'
|
73
|
+
assert_equal 201, response.status
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
58
77
|
private
|
59
78
|
|
60
79
|
def without_layouts
|
@@ -67,12 +86,12 @@ class ErrorJsonTest < ActionDispatch::IntegrationTest
|
|
67
86
|
`mv error.html.erb test/fake_app/app/views/layouts/`
|
68
87
|
end
|
69
88
|
|
70
|
-
def get(path)
|
89
|
+
def get(path, params: {}, headers: {})
|
71
90
|
without_layouts do
|
72
91
|
if Rails::VERSION::STRING >= '5.1.0'
|
73
|
-
super path, headers: { "CONTENT_TYPE" => "application/json", "HTTP_ACCEPT" => "application/json" }
|
92
|
+
super path, params: params, headers: { "CONTENT_TYPE" => "application/json", "HTTP_ACCEPT" => "application/json" }.merge(headers)
|
74
93
|
else
|
75
|
-
super path,
|
94
|
+
super path, params, { "CONTENT_TYPE" => "application/json", "HTTP_ACCEPT" => "application/json" }.merge(headers)
|
76
95
|
end
|
77
96
|
end
|
78
97
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rambulance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuki Nishijima
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|