route.get("/") #7513
-
Hi, Very small issue In the docs it is recommended to do
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 Why it's relevant: often times clients will drop headers on a redirect, which will drop the authorization header. |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 1 reply
-
Have you tried empty string ( |
Beta Was this translation helpful? Give feedback.
-
That could work too but (IMO) looks strange. I think this is mostly a documentation issue |
Beta Was this translation helpful? Give feedback.
-
FYI @tiangolo it looks like regex in the path is broken as of the latest release
now returns a 404. Could be related to a starlette change |
Beta Was this translation helpful? Give feedback.
-
@curtiscook yeah I agree it looks strange, but It is supported only for those special cases but is not recommended. |
Beta Was this translation helpful? Give feedback.
-
Yeah, I think the only thing to do here would be to update the docs to be a little more clear?
|
Beta Was this translation helpful? Give feedback.
-
Hey @curtiscook, check out my solution here. The annotator-for-annotators solution should allow for you to enter use either "/" or "/foo" and have the alternative route included. |
Beta Was this translation helpful? Give feedback.
-
Assuming the original need was handled, this will be automatically closed now. But feel free to add more comments or create new issues or PRs. |
Beta Was this translation helpful? Give feedback.
@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.