From 0d942e61619408098fe0fd7d3d3c2c6915f6caf1 Mon Sep 17 00:00:00 2001 From: Fernando Valverde Date: Wed, 20 Jul 2022 07:51:33 -0600 Subject: [PATCH] API V1 skip authenticity token validation (#18142) * Skip authenticity token on API V1 * Test execution experiment - should fail * Fix specs test * Remove listings v1 controller before_action hook --- app/controllers/api/v1/api_controller.rb | 2 ++ app/controllers/api/v1/listings_controller.rb | 1 - 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/v1/api_controller.rb b/app/controllers/api/v1/api_controller.rb index e80bc8d71..6be086999 100644 --- a/app/controllers/api/v1/api_controller.rb +++ b/app/controllers/api/v1/api_controller.rb @@ -6,6 +6,8 @@ module Api self.api_action = true + skip_before_action :verify_authenticity_token + rescue_from ActionController::ParameterMissing do |exc| error_unprocessable_entity(exc.message) end diff --git a/app/controllers/api/v1/listings_controller.rb b/app/controllers/api/v1/listings_controller.rb index 01a99f94a..57d362ace 100644 --- a/app/controllers/api/v1/listings_controller.rb +++ b/app/controllers/api/v1/listings_controller.rb @@ -8,7 +8,6 @@ module Api before_action :authenticate! before_action :set_cache_control_headers, only: %i[index show] before_action :set_and_authorize_listing, only: %i[update] - skip_before_action :verify_authenticity_token, only: %i[create update] end end end