diff --git a/app/controllers/api/v1/registrant/auth_controller.rb b/app/controllers/api/v1/registrant/auth_controller.rb index 7ba0e9199..5be48f558 100644 --- a/app/controllers/api/v1/registrant/auth_controller.rb +++ b/app/controllers/api/v1/registrant/auth_controller.rb @@ -46,7 +46,7 @@ module Api allowed_ips = ENV['registrant_api_auth_allowed_ips'].to_s.split(',').map(&:strip) return if allowed_ips.include?(request.ip) || Rails.env.development? - render json: { error: 'Not authorized' }, status: :unauthorized + render json: { errors: ['Not authorized'] }, status: :unauthorized end end end diff --git a/app/controllers/api/v1/registrant/base_controller.rb b/app/controllers/api/v1/registrant/base_controller.rb index 510f16745..bc5fa21d7 100644 --- a/app/controllers/api/v1/registrant/base_controller.rb +++ b/app/controllers/api/v1/registrant/base_controller.rb @@ -29,7 +29,7 @@ module Api if decryptor.valid? sign_in decryptor.user else - render json: { error: 'Not authorized' }, status: :unauthorized + render json: { errors: ['Not authorized'] }, status: :unauthorized end end end diff --git a/test/integration/api/registrant/registrant_api_authentication_test.rb b/test/integration/api/registrant/registrant_api_authentication_test.rb index cdcd53025..14ef1c879 100644 --- a/test/integration/api/registrant/registrant_api_authentication_test.rb +++ b/test/integration/api/registrant/registrant_api_authentication_test.rb @@ -42,7 +42,7 @@ class RegistrantApiAuthenticationTest < ActionDispatch::IntegrationTest assert_equal(401, response.status) json_body = JSON.parse(response.body, symbolize_names: true) - assert_equal({error: 'Not authorized'}, json_body) + assert_equal({ errors: ['Not authorized'] }, json_body) ENV['registrant_api_auth_allowed_ips'] = @original_whitelist_ip end @@ -52,7 +52,7 @@ class RegistrantApiAuthenticationTest < ActionDispatch::IntegrationTest post '/api/v1/registrant/auth/eid', params json = JSON.parse(response.body, symbolize_names: true) - assert_equal({errors: [{ident: ['parameter is required']}]}, json) + assert_equal({ errors: [{ ident: ['parameter is required'] }] }, json) assert_equal(422, response.status) end end diff --git a/test/integration/api/registrant/registrant_api_domains_test.rb b/test/integration/api/registrant/registrant_api_domains_test.rb index 1c91d4775..2d0b83903 100644 --- a/test/integration/api/registrant/registrant_api_domains_test.rb +++ b/test/integration/api/registrant/registrant_api_domains_test.rb @@ -19,7 +19,7 @@ class RegistrantApiDomainsTest < ActionDispatch::IntegrationTest assert_equal(401, response.status) json_body = JSON.parse(response.body, symbolize_names: true) - assert_equal({error: 'Not authorized'}, json_body) + assert_equal({ errors: ['Not authorized'] }, json_body) end private