Allow unauthenticated requests to API ping
This commit is contained in:
parent
94f62bcf4e
commit
6c0736da74
@ -3,7 +3,7 @@ module API
|
|||||||
rescue_from ActiveRecord::RecordNotFound, with: :not_found
|
rescue_from ActiveRecord::RecordNotFound, with: :not_found
|
||||||
|
|
||||||
skip_before_filter :verify_authenticity_token
|
skip_before_filter :verify_authenticity_token
|
||||||
skip_before_filter :authenticate!, only: :cor_preflight
|
skip_before_filter :authenticate!, only: %i[cor_preflight ping]
|
||||||
|
|
||||||
before_filter :cor_filter
|
before_filter :cor_filter
|
||||||
before_filter :json_filter!, except: :cor_preflight
|
before_filter :json_filter!, except: :cor_preflight
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
describe 'API application' do
|
describe 'API application' do
|
||||||
include AcceptanceHelpers
|
include AcceptanceHelpers
|
||||||
|
|
||||||
before { api_sign_in }
|
|
||||||
|
|
||||||
describe 'ping endpoint' do
|
describe 'ping endpoint' do
|
||||||
before { get api_ping_path, format: :json }
|
before { get api_ping_path, format: :json }
|
||||||
|
|
||||||
@ -12,6 +10,8 @@ describe 'API application' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe 'formats handling' do
|
describe 'formats handling' do
|
||||||
|
before { api_sign_in }
|
||||||
|
|
||||||
it 'responds with a 406 when request format is not JSON' do
|
it 'responds with a 406 when request format is not JSON' do
|
||||||
get api_ping_path, format: :xml
|
get api_ping_path, format: :xml
|
||||||
expect(response.status).to be 406
|
expect(response.status).to be 406
|
||||||
@ -21,6 +21,8 @@ describe 'API application' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe 'not found' do
|
describe 'not found' do
|
||||||
|
before { api_sign_in }
|
||||||
|
|
||||||
it 'responds with a 404 when route does not exist' do
|
it 'responds with a 404 when route does not exist' do
|
||||||
get '/api/not_found', format: :json
|
get '/api/not_found', format: :json
|
||||||
expect(response.status).to be 404
|
expect(response.status).to be 404
|
||||||
|
Loading…
x
Reference in New Issue
Block a user