rack-jsonparser 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rack/json_parser.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 508f6d75e251f5d822df0c4331528cf47681335b
|
4
|
+
data.tar.gz: 628f1b75e974dd6b2b139ae634779247ca4d4367
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b805fd87a1d113f7a94f83b237ee9f80189892e14c0ceb1ba410003e273759bf6500dccd8690d70b480706c51f9d05b784369e80a8eb17ab03026b5a9cf4eb0
|
7
|
+
data.tar.gz: 96281753773477c0cb4dbabec6a77c520f2e46811cfc985743fa4371b46d18ab71a08cdadf7af47545f376d856aa8ac3f7653db7389d382c6a311d66f173d517
|
data/lib/rack/json_parser.rb
CHANGED
@@ -28,10 +28,10 @@ module Rack
|
|
28
28
|
end
|
29
29
|
|
30
30
|
# Loads the request JSON string into a Hash instance.
|
31
|
-
# Expects the app response body to be an object
|
31
|
+
# Expects the app response body to be an object e.g. Hash,
|
32
32
|
# putting the object in an array will likely cause unexpected JSON.
|
33
33
|
# If the response body is processed then the `Content-Length` header will
|
34
|
-
# be set to the body#length.
|
34
|
+
# be set to the body#length.
|
35
35
|
def call(env)
|
36
36
|
env = Rack::Utils::HeaderHash.new(env)
|
37
37
|
|
@@ -43,7 +43,7 @@ module Rack
|
|
43
43
|
headers = Rack::Utils::HeaderHash.new(headers)
|
44
44
|
|
45
45
|
if transform_response?(headers, body)
|
46
|
-
body = Oj.dump(body)
|
46
|
+
body = Oj.dump(body) unless body.is_a?(String)
|
47
47
|
headers[CONTENT_LENGTH_KEY] = body.length.to_s
|
48
48
|
body = [body] unless body.respond_to?(:each)
|
49
49
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-jsonparser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Telford
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|