Fix JSON responses returning 302 instead of 401
Originally, URLs such as http://localhost:3000/h5bp/non-existent-project/blob/master/test.txt returned a 401 instead of a 302 if the user was not logged in.
If ProjectUrlConstrainer
doesn't return true, it gets caught by our
wildcard route:
get '*unmatched_route', to: 'application#route_not_found'
This has a glob but format: false
is not set so the end part is still
treated as the format
param of this route (i.e. something like
*unmatched_route(.:format)).
This change makes it so that only those that get caught by *unmatched_route' are forced a redirect and #find_routable! which calls requests.
Edited by Stan Hu