Skip to content

Commit 21ad119

Browse files
committed
fix(routes): POST /
1 parent 16d364d commit 21ad119

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

config/routes.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
namespace :api do
2626
root to: 'base#index', as: :root
2727
match '/error', to: 'base#error', via: :all
28-
match '*not_found', to: 'base#respond_404', via: :all
28+
match '(*not_found)', to: 'base#respond_404', via: :all
2929
end
3030

3131
# error pages
@@ -37,5 +37,5 @@
3737
end
3838

3939
# must put this line to bottom of routes.rb
40-
match '*not_found', to: 'errors#not_found', via: :all
40+
match '(*not_found)', to: 'errors#not_found', via: :all
4141
end

spec/requests/errors_controller_spec.rb

+7
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,12 @@
2020
expect(response.status).to eq(404)
2121
expect(response.body).to include('Page not found')
2222
end
23+
24+
it 'root' do
25+
post '/'
26+
expect(response.status).to eq(404)
27+
post '/api'
28+
expect(response.status).to eq(404)
29+
end
2330
end
2431
end

0 commit comments

Comments
 (0)