Skip to content
New issue

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

Trailing slash is required when making requests #82

Open
paul121 opened this issue Apr 15, 2020 · 1 comment
Open

Trailing slash is required when making requests #82

paul121 opened this issue Apr 15, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@paul121
Copy link
Member

paul121 commented Apr 15, 2020

There has been some weird issues where requests without the trailing slash fail, or default to a different request method.

When sending a POST to api/v1/farms, we seemed to get the response of a GET request. Sending the same request to api/v1/farms/ would indeed POST.

@paul121 paul121 added the bug Something isn't working label Apr 15, 2020
@paul121 paul121 added this to the v1.1.0 milestone Apr 23, 2020
@paul121
Copy link
Member Author

paul121 commented Apr 23, 2020

Updating the FastAPI dependency to v0.54.1 fixed this issue. (Relevant changes were included in v0.50.0)

With the latest version a POST or GET to api/v1/farms will return an HTTP 307 redirect to api/v1/farms/. Testing this in curl you must supply the -L flag to follow redirects. But requests in the browser should normally redirect fine.

What I did find troubling, however, is that requsts to api/v1/farms/logs without a trailing slash, such as api/v1/farms/logs?farm_id=1&id=1 are failing. The redirect works, but the FastAPI seems to then interpret the farm_id query param as a path param instead.

I'm unsure if it is a FastAPI issue or something wrong with how I configured the routes and query params. I created a FastAPI issue with more details: tiangolo/fastapi#1314

This isn't critical right now, but does seem to be an issue nonetheless. I'll leave this open for now.

@paul121 paul121 removed this from the v1.1.0 milestone Mar 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

1 participant