grape-batch 2.0.1 → 2.1.0

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
  SHA1:
3
- metadata.gz: bbbf72e7d25fcf89c630726e596e076196efe570
4
- data.tar.gz: afdfe942d8894569147cec3e7665c1f7ef03811e
3
+ metadata.gz: 4e44f52d84088c227271799372c1dc9cdd570b65
4
+ data.tar.gz: bb3eebf865d2d329e81ad97e85655b1035faf4fd
5
5
  SHA512:
6
- metadata.gz: 792bfb7fa1ad3361706e79035093e3b4ec9b26764f3d1810584345e72ee37f2365a1d404a958ce96de6790bb8179cbf21dafd4bfd335e336a54a03798c1d7774
7
- data.tar.gz: 49ca34252acda3520aac0c20eb8efc597422ac2a1e1e3764bb828e71d8705cedc1d9fe50198823d86d34ef21d39a0717f48220695f3fe617b64ff44f9d589a1a
6
+ metadata.gz: 784cc47d4012ce202e0c089d50dd85fde29388a44758c01f7066ed9ef46c651c5eade41d4089d4753075f5a6722c95486685bcf3511e41bd0d146724c70ca16b
7
+ data.tar.gz: 133f5ba1ed2ca8efe5252acb652fb6dc15f6f07cf72b38d6ac32ee641d388b0ac7ac7030956b0bfab8d5bc4255a5393eca2646544e6e82191b7c165d51e6cd35
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ # 2.1.0 (4th November 2015)
2
+ * Removed error response format because of unexpected side effects
3
+
1
4
  # 2.0.1 (30th September 2015)
2
5
  * Removed obsolete gem dependencies
3
6
  * Now ensures the response is properly formatted and not empty, or returns an error
data/lib/grape/batch.rb CHANGED
@@ -57,7 +57,7 @@ module Grape
57
57
  status, headers, response = @app.call(tmp_env)
58
58
 
59
59
  # format response
60
- @response_klass::format(status, headers, response, tmp_env)
60
+ @response_klass::format(status, headers, response)
61
61
  end
62
62
  end
63
63
 
@@ -1,22 +1,10 @@
1
1
  class Grape::Batch::Response
2
- def self.format(status, headers, response, env)
2
+ def self.format(status, headers, response)
3
3
  if response
4
4
  body = response.respond_to?(:body) ? response.body.join : response.join
5
- parsing_failed = true
6
-
7
- begin
8
- result = MultiJson.decode(body)
9
- parsing_failed = false
10
- rescue MultiJson::ParseError
11
- # Captain planet to the rescue
12
- end
13
- end
14
-
15
- if parsing_failed || result.empty?
16
- status = 404
17
- result = { 'error' => "#{env['PATH_INFO']} not found" }
5
+ result = MultiJson.decode(body)
18
6
  end
19
7
 
20
- (200..299).include?(status) ? { success: result } : { code: status, error: result['error'] }
8
+ (200..299).include?(status) ? {success: result} : {code: status, error: result['error']}
21
9
  end
22
10
  end
@@ -1,5 +1,5 @@
1
1
  module Grape
2
2
  module Batch
3
- VERSION = '2.0.1'
3
+ VERSION = '2.1.0'
4
4
  end
5
5
  end
@@ -134,12 +134,6 @@ RSpec.describe Grape::Batch::Base do
134
134
  it { expect(response.body).to eq(encode([{ success: 'status 856' }])) }
135
135
  end
136
136
 
137
- context 'with an unknown version' do
138
- let(:request_body) { encode({ requests: [{ method: 'GET', path: '/api/v2/status', body: { id: 856 } }] }) }
139
- it { expect(response.status).to eq(200) }
140
- it { expect(response.body).to eq(encode([{ code: 404, error: '/api/v2/status not found' }])) }
141
- end
142
-
143
137
  context 'with a body and nested hash' do
144
138
  let(:complex) do
145
139
  { a: { b: { c: 1 } } }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-batch
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lionel Oto
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-09-30 00:00:00.000000000 Z
13
+ date: 2015-11-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: grape