From 8a4030c25da9ace37ca5f7437542572e1b354680 Mon Sep 17 00:00:00 2001 From: Andy Zhao Date: Fri, 6 Sep 2019 11:54:35 -0400 Subject: [PATCH] Revert changes as a hotfix (#3964) --- app/controllers/application_controller.rb | 8 -------- config/routes.rb | 2 -- spec/requests/api/v0/articles_spec.rb | 6 ------ 3 files changed, 16 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e6ebaa5ad..fcf6d361c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -77,12 +77,4 @@ class ApplicationController < ActionController::Base def touch_current_user current_user.touch end - - def routing_error - if params[:path].start_with?("api") - render json: { error: "not found", status: 404 }, status: :not_found - else - render "public/404.html", status: :not_found, layout: false - end - end end diff --git a/config/routes.rb b/config/routes.rb index 56da7dfc7..be1fe7ff3 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -380,8 +380,6 @@ Rails.application.routes.draw do get "/:username" => "stories#index" root "stories#index" - - match '*path', to: 'application#routing_error', via: [:get, :post] end # rubocop:enable Metrics/BlockLength diff --git a/spec/requests/api/v0/articles_spec.rb b/spec/requests/api/v0/articles_spec.rb index 1b45db9ee..de489e949 100644 --- a/spec/requests/api/v0/articles_spec.rb +++ b/spec/requests/api/v0/articles_spec.rb @@ -188,12 +188,6 @@ RSpec.describe "Api::V0::Articles", type: :request do expected_order = json_response.map { |resp| resp["published"] } expect(expected_order).to eq([false, true]) end - - it "returns 404 JSON error for an unsupported option" do - get me_api_articles_path(status: :foobar), params: { access_token: access_token.token } - expect(response).to have_http_status(:not_found) - expect(json_response["error"]).to eq("not found") - end end end