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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rack/json_parser.rb +3 -3
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eeb2c4bc5099283ea4b4c2afdb5c7438545bef0e
4
- data.tar.gz: 1888590a39577b3974a241777788f9ae1ef475c4
3
+ metadata.gz: 508f6d75e251f5d822df0c4331528cf47681335b
4
+ data.tar.gz: 628f1b75e974dd6b2b139ae634779247ca4d4367
5
5
  SHA512:
6
- metadata.gz: 99221a9127516bc47ef8a343d9a2c4c32f10a943601ba1c5f4482fb5a32f8f99d6abdf41e9f76a99055929f874477a8fea720da851be4316ff679745c82cb113
7
- data.tar.gz: 204ff7979716c923314a1bd32857dfa6de9ded7b27e9889a7ed756cbe5f3987d1864ea8624db9f3a2c018d1622c9e63e352d3868b2b709cfcfaadee42e0340fc
6
+ metadata.gz: 5b805fd87a1d113f7a94f83b237ee9f80189892e14c0ceb1ba410003e273759bf6500dccd8690d70b480706c51f9d05b784369e80a8eb17ab03026b5a9cf4eb0
7
+ data.tar.gz: 96281753773477c0cb4dbabec6a77c520f2e46811cfc985743fa4371b46d18ab71a08cdadf7af47545f376d856aa8ac3f7653db7389d382c6a311d66f173d517
@@ -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 instance e.g. Hash,
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.1
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-06 00:00:00.000000000 Z
11
+ date: 2017-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: oj