Hi,
Very small issue
In the docs it is recommended to do
@route.get("/")
for the base path on a router (or endpoint). However, this causes a 307 redirect to include the trailing slash, which is inconsistent with the standard behavior of no trailing slash.
You can work around the issue with
@route.get("/?") but @route.get() is unsupported
Maybe it would be helpful to
a) update the docs around this behavior
b) support @route.get() with no parameters ?
Why it's relevant: often times clients will drop headers on a redirect, which will drop the authorization header.
Have you tried empty string (@route.get(""))? I've used it as a workaround for the 307-redirect "issue".
That could work too but (IMO) looks strange.
I think this is mostly a documentation issue
FYI @tiangolo it looks like regex in the path is broken as of the latest release
@route.get("/?")
now returns a 404. Could be related to a starlette change
@curtiscook yeah @router.get("") would be the way to go, as @David-Lor says.
I agree it looks strange, but @router.get() seems even stranger (at least to me) and would be more difficult to handle internally.
It is supported only for those special cases but is not recommended.
@curtiscook yeah
@router.get("")would be the way to go, as @David-Lor says.I agree it looks strange, but
@router.get()seems even stranger (at least to me) and would be more difficult to handle internally.It is supported only for those special cases but is not recommended.
Yeah, I think the only thing to do here would be to update the docs to be a little more clear?
@router.get("/") doesn't match @router.get("/foo") with regards to the trailing slash
Most helpful comment
That could work too but (IMO) looks strange.
I think this is mostly a documentation issue