We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 9873491 + 27b0f56 commit c788a47Copy full SHA for c788a47
spec/grape/middleware/versioner/header_spec.rb
@@ -224,6 +224,16 @@
224
end
225
226
227
+ it 'fails with 406 Not Acceptable if header contains a single invalid accept' do
228
+ expect { subject.call('HTTP_ACCEPT' => 'application/json;application/vnd.vendor-v1+json').first }
229
+ .to raise_exception do |exception|
230
+ expect(exception).to be_a(Grape::Exceptions::InvalidAcceptHeader)
231
+ expect(exception.headers).to eql({})
232
+ expect(exception.status).to eql 406
233
+ expect(exception.message).to include('API vendor or version not found.')
234
+ end
235
236
+
237
it 'succeeds if proper header is set' do
238
expect(subject.call('HTTP_ACCEPT' => 'application/vnd.vendor-v1+json').first).to eq(200)
239
0 commit comments