rack-json_response_wrapper 0.1.1 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 627f275224585a9e311092f118d87417e9cc0f24
4
- data.tar.gz: 6c6dea76b77f3ac7bd03fb36dc4fd82b50d92591
3
+ metadata.gz: 61c133c2d526f015d9f223b886de8e0f39e08417
4
+ data.tar.gz: 108cfccb51f6368ccc3984a4e7a909392c71a49e
5
5
  SHA512:
6
- metadata.gz: e224b62a3246391cb8b93c7c34186359f08c569088953a2ad6d4b552b4519ac8bd86a8d29a5ca775aa2653cedfe367a7e371b8606212d068f0159cdc9ae47bad
7
- data.tar.gz: 179308da01f784339d4bef718caa01e1440708adfc1da91d3ad9dcbfd48882414431e0facdb9bc4f97f6471a91750e5a6871b63d3d4078c4a8971174eff7d38d
6
+ metadata.gz: 5df23e99db9d44a09eb8701e3aae86788ac9f90492af844cc085d87ab6c487820efe4b0c3733afdae9289f7b23c5c0aa36e83c51dfd36834bd1efafe456bca7f
7
+ data.tar.gz: b5d5dfbccfd8f49741aa6d94af061effee9440ddddf401d1975093d99c1d2353bd01fb017beefe0deac2a37c65f152938638b75ec17fd2e9601668d365b3824b
data/README.md CHANGED
@@ -3,7 +3,7 @@ rack-json_response_wrapper
3
3
 
4
4
  Rack Middleware for JSON APIs accessed cross-domain from legacy browsers
5
5
 
6
- Firefox version 4 does not support response headers for cross-domain requests. This middleware intercepts all requests and if the X-WRAP-RESPONSE is set, the response will be wrappped in JSON as follows:
6
+ Firefox versions <4 does not support response headers for cross-domain requests. This middleware intercepts all requests and if the X-WRAP-RESPONSE is set, the response will be wrappped in JSON as follows:
7
7
 
8
8
  Suppose the following is the original response body:
9
9
 
@@ -47,9 +47,9 @@ module Rack
47
47
  # when we change the content-length, the length will change.
48
48
  # therefore, calculate the offset by comparing the length of the old vs. new
49
49
  original_content_length = response_header['Content-Length']
50
- new_content_length = wrapped_body.length
50
+ new_content_length = wrapped_body.bytesize
51
51
  adjusted_content_length =
52
- new_content_length.to_s.to_json.length - original_content_length.to_s.to_json.length
52
+ new_content_length.to_s.to_json.bytesize - original_content_length.to_s.to_json.bytesize
53
53
 
54
54
  # adjust the new content-length by this offset
55
55
  new_content_length += adjusted_content_length
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-json_response_wrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - g. nicholas d'andrea
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-27 00:00:00.000000000 Z
11
+ date: 2014-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec