We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Requesting not existing api route causes infinite redirect loop
Return 404?
Started GET "/api/v1/v.json" for 127.0.0.1 at 2018-08-28 13:34:15 +0300 13:34:15 web.1 | Started GET "/api/v1/v.json" for 127.0.0.1 at 2018-08-28 13:34:15 +0300 13:34:15 web.1 | Started GET "/api/v1/v.json" for 127.0.0.1 at 2018-08-28 13:34:15 +0300 13:34:15 web.1 | Started GET "/api/v1/v.json" for 127.0.0.1 at 2018-08-28 13:34:15 +0300 13:34:15 web.1 | Started GET "/api/v1/v.json" for 127.0.0.1 at 2018-08-28 13:34:15 +0300 13:34:15 web.1 | Started GET "/api/v1/v.json" for 127.0.0.1 at 2018-08-28 13:34:15 +0300 13:34:15 web.1 | Started GET "/api/v1/v.json" for 127.0.0.1 at 2018-08-28 13:34:15 +0300 13:34:15 web.1 | Started GET "/api/v1/v.json" for 127.0.0.1 at 2018-08-28 13:34:15 +0300 13:34:15 web.1 | Started GET "/api/v1/v.json" for 127.0.0.1 at 2018-08-28 13:34:15 +0300 13:34:15 web.1 | Started GET "/api/v1/v.json" for 127.0.0.1 at 2018-08-28 13:34:15 +0300 ...
It's caused by 2 last route matches in api routes config. Maybe check for format in path can help
https://github.com/spree/spree/blob/master/api/config/routes.rb#L145
match 'v:api/*path', to: redirect { |params, request| format = ".#{params[:format]}" unless params[:format].blank? query = "?#{request.query_string}" unless request.query_string.blank? "#{spree_path}api/v1/#{params[:path]}#{format}#{query}" }, via: [:get, :post, :put, :patch, :delete]
ERR_TOO_MANY_REDIRECTS
Sample spec (storefront/products does not exist in api v1)
it 'returns 404' do visit '/api/v1/storefront/products' expect(response.status).to eq 404 end
Failures: 1) API V1 api request when route does not exist returns 404 Failure/Error: visit '/api/v1/storefront/products' Capybara::InfiniteRedirectError: redirected more than 5 times, check for infinite redirects.
spree master
The text was updated successfully, but these errors were encountered:
Hey @artplan1 this was fixed via #8976 , you can update spree to 3.7.0.beta
3.7.0.beta
Sorry, something went wrong.
No branches or pull requests
Context
Requesting not existing api route causes infinite redirect loop
Expected Behavior
Return 404?
Actual Behavior
Possible Fix
It's caused by 2 last route matches in api routes config. Maybe check for format in path can help
https://github.com/spree/spree/blob/master/api/config/routes.rb#L145
Steps to Reproduce
ERR_TOO_MANY_REDIRECTS
Sample spec (storefront/products does not exist in api v1)
Your Environment
spree master
The text was updated successfully, but these errors were encountered: