grape 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of grape might be problematic. Click here for more details.

Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop_todo.yml +23 -80
  3. data/.travis.yml +1 -1
  4. data/CHANGELOG.md +27 -0
  5. data/Gemfile +1 -1
  6. data/Guardfile +1 -1
  7. data/LICENSE +1 -1
  8. data/README.md +131 -30
  9. data/Rakefile +1 -1
  10. data/UPGRADING.md +110 -1
  11. data/gemfiles/rails_3.gemfile +1 -1
  12. data/gemfiles/rails_4.gemfile +1 -1
  13. data/grape.gemspec +4 -4
  14. data/lib/grape.rb +92 -62
  15. data/lib/grape/api.rb +10 -10
  16. data/lib/grape/cookies.rb +1 -1
  17. data/lib/grape/dsl/configuration.rb +7 -7
  18. data/lib/grape/dsl/helpers.rb +3 -3
  19. data/lib/grape/dsl/inside_route.rb +50 -21
  20. data/lib/grape/dsl/parameters.rb +25 -6
  21. data/lib/grape/dsl/request_response.rb +1 -1
  22. data/lib/grape/dsl/routing.rb +11 -10
  23. data/lib/grape/dsl/settings.rb +1 -1
  24. data/lib/grape/endpoint.rb +21 -19
  25. data/lib/grape/error_formatter/json.rb +1 -1
  26. data/lib/grape/exceptions/base.rb +1 -1
  27. data/lib/grape/exceptions/validation.rb +1 -1
  28. data/lib/grape/exceptions/validation_errors.rb +2 -2
  29. data/lib/grape/formatter/base.rb +1 -1
  30. data/lib/grape/formatter/json.rb +1 -1
  31. data/lib/grape/formatter/serializable_hash.rb +4 -4
  32. data/lib/grape/formatter/txt.rb +1 -1
  33. data/lib/grape/formatter/xml.rb +1 -1
  34. data/lib/grape/http/headers.rb +27 -0
  35. data/lib/grape/http/request.rb +1 -1
  36. data/lib/grape/middleware/error.rb +10 -4
  37. data/lib/grape/middleware/formatter.rb +13 -9
  38. data/lib/grape/middleware/globals.rb +2 -1
  39. data/lib/grape/middleware/versioner/accept_version_header.rb +2 -2
  40. data/lib/grape/middleware/versioner/header.rb +4 -4
  41. data/lib/grape/middleware/versioner/param.rb +2 -2
  42. data/lib/grape/middleware/versioner/path.rb +1 -1
  43. data/lib/grape/namespace.rb +2 -1
  44. data/lib/grape/parser/json.rb +1 -1
  45. data/lib/grape/parser/xml.rb +1 -1
  46. data/lib/grape/path.rb +3 -3
  47. data/lib/grape/presenters/presenter.rb +9 -0
  48. data/lib/grape/validations/params_scope.rb +3 -3
  49. data/lib/grape/validations/validators/allow_blank.rb +1 -1
  50. data/lib/grape/validations/validators/coerce.rb +6 -5
  51. data/lib/grape/validations/validators/default.rb +2 -2
  52. data/lib/grape/validations/validators/multiple_params_base.rb +1 -0
  53. data/lib/grape/validations/validators/regexp.rb +1 -1
  54. data/lib/grape/version.rb +1 -1
  55. data/spec/grape/api/custom_validations_spec.rb +47 -0
  56. data/spec/grape/api/deeply_included_options_spec.rb +56 -0
  57. data/spec/grape/api_spec.rb +64 -42
  58. data/spec/grape/dsl/configuration_spec.rb +2 -2
  59. data/spec/grape/dsl/helpers_spec.rb +1 -1
  60. data/spec/grape/dsl/inside_route_spec.rb +75 -19
  61. data/spec/grape/dsl/parameters_spec.rb +59 -10
  62. data/spec/grape/dsl/request_response_spec.rb +62 -2
  63. data/spec/grape/dsl/routing_spec.rb +116 -18
  64. data/spec/grape/endpoint_spec.rb +57 -5
  65. data/spec/grape/entity_spec.rb +1 -1
  66. data/spec/grape/exceptions/body_parse_errors_spec.rb +5 -5
  67. data/spec/grape/exceptions/invalid_accept_header_spec.rb +32 -32
  68. data/spec/grape/exceptions/validation_errors_spec.rb +1 -1
  69. data/spec/grape/integration/rack_spec.rb +4 -3
  70. data/spec/grape/middleware/auth/strategies_spec.rb +2 -2
  71. data/spec/grape/middleware/base_spec.rb +2 -2
  72. data/spec/grape/middleware/error_spec.rb +1 -1
  73. data/spec/grape/middleware/exception_spec.rb +5 -5
  74. data/spec/grape/middleware/formatter_spec.rb +10 -10
  75. data/spec/grape/middleware/globals_spec.rb +27 -0
  76. data/spec/grape/middleware/versioner/accept_version_header_spec.rb +1 -1
  77. data/spec/grape/middleware/versioner/header_spec.rb +1 -1
  78. data/spec/grape/middleware/versioner/param_spec.rb +1 -1
  79. data/spec/grape/middleware/versioner/path_spec.rb +1 -1
  80. data/spec/grape/path_spec.rb +6 -4
  81. data/spec/grape/presenters/presenter_spec.rb +70 -0
  82. data/spec/grape/util/inheritable_values_spec.rb +1 -1
  83. data/spec/grape/util/stackable_values_spec.rb +1 -1
  84. data/spec/grape/util/strict_hash_configuration_spec.rb +1 -1
  85. data/spec/grape/validations/params_scope_spec.rb +64 -0
  86. data/spec/grape/validations/validators/allow_blank_spec.rb +10 -0
  87. data/spec/grape/validations/validators/coerce_spec.rb +48 -18
  88. data/spec/grape/validations/validators/default_spec.rb +110 -20
  89. data/spec/grape/validations/validators/presence_spec.rb +41 -3
  90. data/spec/grape/validations/validators/regexp_spec.rb +7 -2
  91. data/spec/grape/validations_spec.rb +20 -1
  92. data/spec/support/file_streamer.rb +11 -0
  93. data/spec/support/versioned_helpers.rb +1 -1
  94. metadata +14 -2
@@ -11,13 +11,13 @@ describe Grape::Endpoint do
11
11
  after { Grape::Endpoint.before_each(nil) }
12
12
 
13
13
  it 'should be settable via block' do
14
- block = lambda { |endpoint| 'noop' }
14
+ block = lambda { |_endpoint| 'noop' }
15
15
  Grape::Endpoint.before_each(&block)
16
16
  expect(Grape::Endpoint.before_each).to eq(block)
17
17
  end
18
18
 
19
19
  it 'should be settable via reference' do
20
- block = lambda { |endpoint| 'noop' }
20
+ block = lambda { |_endpoint| 'noop' }
21
21
  Grape::Endpoint.before_each block
22
22
  expect(Grape::Endpoint.before_each).to eq(block)
23
23
  end
@@ -116,8 +116,8 @@ describe Grape::Endpoint do
116
116
  it 'includes request headers' do
117
117
  get '/headers'
118
118
  expect(JSON.parse(last_response.body)).to eq(
119
- 'Host' => 'example.org',
120
- 'Cookie' => ''
119
+ 'Host' => 'example.org',
120
+ 'Cookie' => ''
121
121
  )
122
122
  end
123
123
  it 'includes additional request headers' do
@@ -153,7 +153,7 @@ describe Grape::Endpoint do
153
153
  'cookie4=secret+code+here',
154
154
  'my-awesome-cookie1=is+cool',
155
155
  'my-awesome-cookie2=is+cool+too; domain=my.example.com; path=/; secure'
156
- ]
156
+ ]
157
157
  end
158
158
 
159
159
  it 'sets browser cookies and does not set response cookies' do
@@ -295,6 +295,44 @@ describe Grape::Endpoint do
295
295
  expect(inner_params[:nested].size).to eq 2
296
296
  end
297
297
 
298
+ it 'builds nested params' do
299
+ inner_params = nil
300
+ subject.get '/declared' do
301
+ inner_params = declared(params)
302
+ ''
303
+ end
304
+
305
+ get '/declared?first=present&nested[fourth]=1'
306
+ expect(last_response.status).to eq(200)
307
+ expect(inner_params[:nested].keys.size).to eq 1
308
+ end
309
+
310
+ context 'sets nested array when the param is missing' do
311
+ it 'to be array when include_missing is true' do
312
+ inner_params = nil
313
+ subject.get '/declared' do
314
+ inner_params = declared(params, include_missing: true)
315
+ ''
316
+ end
317
+
318
+ get '/declared?first=present'
319
+ expect(last_response.status).to eq(200)
320
+ expect(inner_params[:nested]).to be_a(Array)
321
+ end
322
+
323
+ it 'to be nil when include_missing is false' do
324
+ inner_params = nil
325
+ subject.get '/declared' do
326
+ inner_params = declared(params, include_missing: false)
327
+ ''
328
+ end
329
+
330
+ get '/declared?first=present'
331
+ expect(last_response.status).to eq(200)
332
+ expect(inner_params[:nested]).to be_nil
333
+ end
334
+ end
335
+
298
336
  it 'filters out any additional params that are given' do
299
337
  inner_params = nil
300
338
  subject.get '/declared' do
@@ -889,4 +927,18 @@ describe Grape::Endpoint do
889
927
  expect(last_response.status).to eq(406)
890
928
  end
891
929
  end
930
+
931
+ context 'binary' do
932
+ before do
933
+ subject.get do
934
+ file FileStreamer.new(__FILE__)
935
+ end
936
+ end
937
+
938
+ it 'suports stream objects in response' do
939
+ get '/'
940
+ expect(last_response.status).to eq 200
941
+ expect(last_response.body).to eq File.read(__FILE__)
942
+ end
943
+ end
892
944
  end
@@ -114,7 +114,7 @@ describe Grape::Entity do
114
114
 
115
115
  it 'does not run autodetection for Entity when explicitely provided' do
116
116
  entity = Class.new(Grape::Entity)
117
- some_array = Array.new
117
+ some_array = []
118
118
 
119
119
  subject.get '/example' do
120
120
  present some_array, with: entity
@@ -3,8 +3,8 @@ require 'spec_helper'
3
3
  describe Grape::Exceptions::ValidationErrors do
4
4
  context 'api with rescue_from :all handler' do
5
5
  subject { Class.new(Grape::API) }
6
- before {
7
- subject.rescue_from :all do |e|
6
+ before do
7
+ subject.rescue_from :all do |_e|
8
8
  rack_response 'message was processed', 400
9
9
  end
10
10
  subject.params do
@@ -13,7 +13,7 @@ describe Grape::Exceptions::ValidationErrors do
13
13
  subject.post '/beer' do
14
14
  'beer received'
15
15
  end
16
- }
16
+ end
17
17
 
18
18
  def app
19
19
  subject
@@ -54,14 +54,14 @@ describe Grape::Exceptions::ValidationErrors do
54
54
 
55
55
  context 'api without a rescue handler' do
56
56
  subject { Class.new(Grape::API) }
57
- before {
57
+ before do
58
58
  subject.params do
59
59
  requires :beer
60
60
  end
61
61
  subject.post '/beer' do
62
62
  'beer received'
63
63
  end
64
- }
64
+ end
65
65
 
66
66
  def app
67
67
  subject
@@ -34,7 +34,7 @@ describe Grape::Exceptions::InvalidAcceptHeader do
34
34
 
35
35
  context 'API with cascade=false and rescue_from :all handler' do
36
36
  subject { Class.new(Grape::API) }
37
- before {
37
+ before do
38
38
  subject.version 'v99', using: :header, vendor: 'vendorname', format: :json, cascade: false
39
39
  subject.rescue_from :all do |e|
40
40
  rack_response 'message was processed', 400, e[:headers]
@@ -42,7 +42,7 @@ describe Grape::Exceptions::InvalidAcceptHeader do
42
42
  subject.get '/beer' do
43
43
  'beer received'
44
44
  end
45
- }
45
+ end
46
46
 
47
47
  def app
48
48
  subject
@@ -55,17 +55,17 @@ describe Grape::Exceptions::InvalidAcceptHeader do
55
55
 
56
56
  context 'that receives' do
57
57
  context 'an invalid version in the request' do
58
- before {
58
+ before do
59
59
  get '/beer', {}, 'HTTP_ACCEPT' => 'application/vnd.vendorname-v77',
60
60
  'CONTENT_TYPE' => 'application/json'
61
- }
61
+ end
62
62
  it_should_behave_like 'a rescued request'
63
63
  end
64
64
  context 'an invalid vendor in the request' do
65
- before {
65
+ before do
66
66
  get '/beer', {}, 'HTTP_ACCEPT' => 'application/vnd.invalidvendor-v99',
67
67
  'CONTENT_TYPE' => 'application/json'
68
- }
68
+ end
69
69
  it_should_behave_like 'a rescued request'
70
70
  end
71
71
  end
@@ -73,12 +73,12 @@ describe Grape::Exceptions::InvalidAcceptHeader do
73
73
 
74
74
  context 'API with cascade=false and without a rescue handler' do
75
75
  subject { Class.new(Grape::API) }
76
- before {
76
+ before do
77
77
  subject.version 'v99', using: :header, vendor: 'vendorname', format: :json, cascade: false
78
78
  subject.get '/beer' do
79
79
  'beer received'
80
80
  end
81
- }
81
+ end
82
82
 
83
83
  def app
84
84
  subject
@@ -103,7 +103,7 @@ describe Grape::Exceptions::InvalidAcceptHeader do
103
103
 
104
104
  context 'API with cascade=false and with rescue_from :all handler and http_codes' do
105
105
  subject { Class.new(Grape::API) }
106
- before {
106
+ before do
107
107
  subject.version 'v99', using: :header, vendor: 'vendorname', format: :json, cascade: false
108
108
  subject.rescue_from :all do |e|
109
109
  rack_response 'message was processed', 400, e[:headers]
@@ -116,7 +116,7 @@ describe Grape::Exceptions::InvalidAcceptHeader do
116
116
  subject.get '/beer' do
117
117
  'beer received'
118
118
  end
119
- }
119
+ end
120
120
 
121
121
  def app
122
122
  subject
@@ -129,17 +129,17 @@ describe Grape::Exceptions::InvalidAcceptHeader do
129
129
 
130
130
  context 'that receives' do
131
131
  context 'an invalid version in the request' do
132
- before {
132
+ before do
133
133
  get '/beer', {}, 'HTTP_ACCEPT' => 'application/vnd.vendorname-v77',
134
134
  'CONTENT_TYPE' => 'application/json'
135
- }
135
+ end
136
136
  it_should_behave_like 'a rescued request'
137
137
  end
138
138
  context 'an invalid vendor in the request' do
139
- before {
139
+ before do
140
140
  get '/beer', {}, 'HTTP_ACCEPT' => 'application/vnd.invalidvendor-v99',
141
141
  'CONTENT_TYPE' => 'application/json'
142
- }
142
+ end
143
143
  it_should_behave_like 'a rescued request'
144
144
  end
145
145
  end
@@ -147,7 +147,7 @@ describe Grape::Exceptions::InvalidAcceptHeader do
147
147
 
148
148
  context 'API with cascade=false, http_codes but without a rescue handler' do
149
149
  subject { Class.new(Grape::API) }
150
- before {
150
+ before do
151
151
  subject.version 'v99', using: :header, vendor: 'vendorname', format: :json, cascade: false
152
152
  subject.desc 'Get beer' do
153
153
  failure [[400, 'Bad Request'], [401, 'Unauthorized'], [403, 'Forbidden'],
@@ -157,7 +157,7 @@ describe Grape::Exceptions::InvalidAcceptHeader do
157
157
  subject.get '/beer' do
158
158
  'beer received'
159
159
  end
160
- }
160
+ end
161
161
 
162
162
  def app
163
163
  subject
@@ -182,7 +182,7 @@ describe Grape::Exceptions::InvalidAcceptHeader do
182
182
 
183
183
  context 'API with cascade=true and rescue_from :all handler' do
184
184
  subject { Class.new(Grape::API) }
185
- before {
185
+ before do
186
186
  subject.version 'v99', using: :header, vendor: 'vendorname', format: :json, cascade: true
187
187
  subject.rescue_from :all do |e|
188
188
  rack_response 'message was processed', 400, e[:headers]
@@ -190,7 +190,7 @@ describe Grape::Exceptions::InvalidAcceptHeader do
190
190
  subject.get '/beer' do
191
191
  'beer received'
192
192
  end
193
- }
193
+ end
194
194
 
195
195
  def app
196
196
  subject
@@ -203,17 +203,17 @@ describe Grape::Exceptions::InvalidAcceptHeader do
203
203
 
204
204
  context 'that receives' do
205
205
  context 'an invalid version in the request' do
206
- before {
206
+ before do
207
207
  get '/beer', {}, 'HTTP_ACCEPT' => 'application/vnd.vendorname-v77',
208
208
  'CONTENT_TYPE' => 'application/json'
209
- }
209
+ end
210
210
  it_should_behave_like 'a cascaded request'
211
211
  end
212
212
  context 'an invalid vendor in the request' do
213
- before {
213
+ before do
214
214
  get '/beer', {}, 'HTTP_ACCEPT' => 'application/vnd.invalidvendor-v99',
215
215
  'CONTENT_TYPE' => 'application/json'
216
- }
216
+ end
217
217
  it_should_behave_like 'a cascaded request'
218
218
  end
219
219
  end
@@ -221,12 +221,12 @@ describe Grape::Exceptions::InvalidAcceptHeader do
221
221
 
222
222
  context 'API with cascade=true and without a rescue handler' do
223
223
  subject { Class.new(Grape::API) }
224
- before {
224
+ before do
225
225
  subject.version 'v99', using: :header, vendor: 'vendorname', format: :json, cascade: true
226
226
  subject.get '/beer' do
227
227
  'beer received'
228
228
  end
229
- }
229
+ end
230
230
 
231
231
  def app
232
232
  subject
@@ -251,7 +251,7 @@ describe Grape::Exceptions::InvalidAcceptHeader do
251
251
 
252
252
  context 'API with cascade=true and with rescue_from :all handler and http_codes' do
253
253
  subject { Class.new(Grape::API) }
254
- before {
254
+ before do
255
255
  subject.version 'v99', using: :header, vendor: 'vendorname', format: :json, cascade: true
256
256
  subject.rescue_from :all do |e|
257
257
  rack_response 'message was processed', 400, e[:headers]
@@ -264,7 +264,7 @@ describe Grape::Exceptions::InvalidAcceptHeader do
264
264
  subject.get '/beer' do
265
265
  'beer received'
266
266
  end
267
- }
267
+ end
268
268
 
269
269
  def app
270
270
  subject
@@ -277,17 +277,17 @@ describe Grape::Exceptions::InvalidAcceptHeader do
277
277
 
278
278
  context 'that receives' do
279
279
  context 'an invalid version in the request' do
280
- before {
280
+ before do
281
281
  get '/beer', {}, 'HTTP_ACCEPT' => 'application/vnd.vendorname-v77',
282
282
  'CONTENT_TYPE' => 'application/json'
283
- }
283
+ end
284
284
  it_should_behave_like 'a cascaded request'
285
285
  end
286
286
  context 'an invalid vendor in the request' do
287
- before {
287
+ before do
288
288
  get '/beer', {}, 'HTTP_ACCEPT' => 'application/vnd.invalidvendor-v99',
289
289
  'CONTENT_TYPE' => 'application/json'
290
- }
290
+ end
291
291
  it_should_behave_like 'a cascaded request'
292
292
  end
293
293
  end
@@ -295,7 +295,7 @@ describe Grape::Exceptions::InvalidAcceptHeader do
295
295
 
296
296
  context 'API with cascade=true, http_codes but without a rescue handler' do
297
297
  subject { Class.new(Grape::API) }
298
- before {
298
+ before do
299
299
  subject.version 'v99', using: :header, vendor: 'vendorname', format: :json, cascade: true
300
300
  subject.desc 'Get beer' do
301
301
  failure [[400, 'Bad Request'], [401, 'Unauthorized'], [403, 'Forbidden'],
@@ -305,7 +305,7 @@ describe Grape::Exceptions::InvalidAcceptHeader do
305
305
  subject.get '/beer' do
306
306
  'beer received'
307
307
  end
308
- }
308
+ end
309
309
 
310
310
  def app
311
311
  subject
@@ -27,7 +27,7 @@ describe Grape::Exceptions::ValidationErrors do
27
27
  it 'can return structured json with separate fields' do
28
28
  subject.format :json
29
29
  subject.rescue_from Grape::Exceptions::ValidationErrors do |e|
30
- rack_response e.to_json, 400
30
+ error!(e, 400)
31
31
  end
32
32
  subject.params do
33
33
  optional :beer
@@ -19,9 +19,10 @@ describe Rack do
19
19
  }
20
20
  env = Rack::MockRequest.env_for('/', options)
21
21
 
22
- # requires Rack 1.6.0 to pass
23
- # can't check explicitly version of Rack because of https://github.com/rack/rack/issues/773
24
- pending 'Rack 1.6.0 is required' unless ::Rack.const_defined?(:TempfileReaper) || RUBY_PLATFORM == 'java'
22
+ unless RUBY_PLATFORM == 'java'
23
+ major, minor, release = Rack.release.split('.').map(&:to_i)
24
+ pending 'Rack 1.5.3 or 1.6.1 required' unless major >= 1 && ((minor == 5 && release >= 3) || (minor >= 6))
25
+ end
25
26
 
26
27
  expect(JSON.parse(app.call(env)[2].body.first)['params_keys']).to match_array('test')
27
28
  ensure
@@ -9,12 +9,12 @@ describe Grape::Middleware::Auth::Strategies do
9
9
  Rack::Builder.new do |b|
10
10
  b.use Grape::Middleware::Error
11
11
  b.use(Grape::Middleware::Auth::Base, type: :http_basic, proc: proc)
12
- b.run lambda { |env| [200, {}, ['Hello there.']] }
12
+ b.run ->(_env) { [200, {}, ['Hello there.']] }
13
13
  end
14
14
  end
15
15
 
16
16
  it 'throws a 401 if no auth is given' do
17
- @proc = lambda { false }
17
+ @proc = -> { false }
18
18
  get '/whatever'
19
19
  expect(last_response.status).to eq(401)
20
20
  end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe Grape::Middleware::Base do
4
4
  subject { Grape::Middleware::Base.new(blank_app) }
5
- let(:blank_app) { lambda { |_| [200, {}, 'Hi there.'] } }
5
+ let(:blank_app) { ->(_) { [200, {}, 'Hi there.'] } }
6
6
 
7
7
  before do
8
8
  # Keep it one object for testing.
@@ -36,7 +36,7 @@ describe Grape::Middleware::Base do
36
36
 
37
37
  describe '#response' do
38
38
  subject { Grape::Middleware::Base.new(response) }
39
- let(:response) { lambda { |_| [204, { abc: 1 }, 'test'] } }
39
+ let(:response) { ->(_) { [204, { abc: 1 }, 'test'] } }
40
40
 
41
41
  it 'status' do
42
42
  subject.call({})
@@ -17,7 +17,7 @@ describe Grape::Middleware::Error do
17
17
  attr_accessor :error
18
18
  attr_accessor :format
19
19
 
20
- def call(env)
20
+ def call(_env)
21
21
  throw :error, error
22
22
  end
23
23
  end
@@ -5,7 +5,7 @@ describe Grape::Middleware::Error do
5
5
  # raises a text exception
6
6
  class ExceptionApp
7
7
  class << self
8
- def call(env)
8
+ def call(_env)
9
9
  fail 'rain!'
10
10
  end
11
11
  end
@@ -18,7 +18,7 @@ describe Grape::Middleware::Error do
18
18
  throw :error, message: { error: message, detail: 'missing widget' }, status: status
19
19
  end
20
20
 
21
- def call(env)
21
+ def call(_env)
22
22
  error!('rain!', 401)
23
23
  end
24
24
  end
@@ -31,7 +31,7 @@ describe Grape::Middleware::Error do
31
31
  throw :error, message: message, status: status
32
32
  end
33
33
 
34
- def call(env)
34
+ def call(_env)
35
35
  error!('Access Denied', 401)
36
36
  end
37
37
  end
@@ -43,7 +43,7 @@ describe Grape::Middleware::Error do
43
43
 
44
44
  class CustomErrorApp
45
45
  class << self
46
- def call(env)
46
+ def call(_env)
47
47
  fail CustomError, status: 400, message: 'failed validation'
48
48
  end
49
49
  end
@@ -160,7 +160,7 @@ describe Grape::Middleware::Error do
160
160
  use Grape::Middleware::Error, rescue_all: true,
161
161
  format: :custom,
162
162
  error_formatters: {
163
- custom: lambda do |message, backtrace, options, env|
163
+ custom: lambda do |message, _backtrace, _options, _env|
164
164
  { custom_formatter: message }.inspect
165
165
  end
166
166
  }