From e3c83c601cf5efcffda86e123ddc6049a7744818 Mon Sep 17 00:00:00 2001 From: Maciej Szlosarczyk Date: Tue, 16 Oct 2018 09:47:33 +0300 Subject: [PATCH] Return empty body in OPTIONS requests --- app/controllers/api/cors_controller.rb | 2 +- .../api/registrant/registrant_api_cors_headers_test.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/cors_controller.rb b/app/controllers/api/cors_controller.rb index c060cd6a1..102f9726f 100644 --- a/app/controllers/api/cors_controller.rb +++ b/app/controllers/api/cors_controller.rb @@ -5,7 +5,7 @@ module Api def cors_preflight_check set_access_control_headers - render json: { status: :ok } + render text: '' end def set_access_control_headers diff --git a/test/integration/api/registrant/registrant_api_cors_headers_test.rb b/test/integration/api/registrant/registrant_api_cors_headers_test.rb index 54cb5894e..1445253fd 100644 --- a/test/integration/api/registrant/registrant_api_cors_headers_test.rb +++ b/test/integration/api/registrant/registrant_api_cors_headers_test.rb @@ -18,4 +18,10 @@ class RegistrantApiCorsHeadersTest < ApplicationIntegrationTest response.headers['Access-Control-Allow-Headers']) assert_equal('3600', response.headers['Access-Control-Max-Age']) end + + def test_returns_empty_body + options '/api/v1/registrant/auth/eid', {} + + assert_equal('', response.body) + end end