modern 0.4.2 → 0.4.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f483d74d2aa71c07344b8ab689d473b52255fe52e93c45116f8f898887989f70
|
4
|
+
data.tar.gz: 81a87980bb858c2839c779f98364f699c4126a908cd4a6b732812dd749956262
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b168abd8e525ab5f8ab193debbc99b94b61b42eb7dab708825d89be5cb0a804c6b15697036db70619c360cf779c1a95847a956e843adad4ca67bf4c71507b958
|
7
|
+
data.tar.gz: 0a0407e5e6c50609c8ecf7ae2d791c33a76fe1a0eebeb28ad0515e196a32ab235db4cb70f701f845d9f1b22c478a7443b24f497e3eb2dbbeb446d295c6cf50e2
|
@@ -32,7 +32,7 @@ module Modern
|
|
32
32
|
|
33
33
|
params = parse_parameters(request, route)
|
34
34
|
body = parse_request_body(request, route) unless route.request_body.nil?
|
35
|
-
raise Errors::BadRequestError \
|
35
|
+
raise Errors::BadRequestError, "Request body is required." \
|
36
36
|
if body.nil? && route.request_body&.required
|
37
37
|
|
38
38
|
begin
|
@@ -20,8 +20,13 @@ module Modern
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def parse_request_body(request, route)
|
23
|
-
|
24
|
-
|
23
|
+
# RFC 2616; you MAY sniff content but SHOULD return application/octet-stream
|
24
|
+
# if the input Content-Type remains unknown. However, it seems like Rack may
|
25
|
+
# default to application/x-www-form-urlencoded; Rack::Test definitely does.
|
26
|
+
content_type = (request.content_type || "application/octet-stream").downcase.strip
|
27
|
+
|
28
|
+
input_converter = determine_input_converter_for_type(content_type, route)
|
29
|
+
raise Modern::Errors::UnsupportedMediaTypeError, content_type if input_converter.nil?
|
25
30
|
|
26
31
|
raw = input_converter.converter.call(request.body)
|
27
32
|
|
@@ -52,11 +57,7 @@ module Modern
|
|
52
57
|
end
|
53
58
|
end
|
54
59
|
|
55
|
-
def
|
56
|
-
# RFC 2616; you MAY sniff content but SHOULD return application/octet-stream
|
57
|
-
# if the input Content-Type remains unknown. However, it seems like Rack may
|
58
|
-
# default to application/x-www-form-urlencoded; Rack::Test definitely does.
|
59
|
-
content_type = (request.content_type || "application/octet-stream").downcase.strip
|
60
|
+
def determine_input_converter_for_type(content_type, route)
|
60
61
|
route.input_converters_by_type[content_type]
|
61
62
|
end
|
62
63
|
end
|
data/lib/modern/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: modern
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ed Ropple
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|