Refuse non-JSON queries on API
This commit is contained in:
@@ -10,4 +10,12 @@ describe 'API application' do
|
||||
expect(json).to eq(pong: 'ok')
|
||||
end
|
||||
end
|
||||
|
||||
describe 'formats handling' do
|
||||
it 'responds with a 406 when request format is not JSON' do
|
||||
get api_ping_path, format: :xml
|
||||
expect(response.status).to be 406
|
||||
expect(response.body).to be_empty
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user