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

.get() method strips trailing slash when GET params are passed in body #88

Open
kz26 opened this Issue Apr 10, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@kz26
Copy link

commented Apr 10, 2019

Affects latest version 2.0.6.

Basic example:

api = new Frisbee(...);
api.get('https://some-url.com/api/things/', {body: {param: something}});

On my test server, the request URL received is https://some-url.com/api/things?param=something, i.e. the trailing slash before the query string is missing. This isn't a big deal in most cases, but for web frameworks like Django that 301-redirect all URLs without trailing slashes, it adds an unnecessary redirect and extra HTTP request.

@kz26 kz26 changed the title .get() method strips trailing slash when GET params are passed .get() method strips trailing slash when GET params are passed in body Apr 10, 2019

@davidgovea

This comment has been minimized.

Copy link
Collaborator

commented Apr 18, 2019

I'm seeing that behavior too. fetch leaves trailing slashes in place, so it makes sense to have frisbee match fetch's behavior.

Tried to write a quick test, but express (used for the test server) does not distinguish between /route and /route/, so a different approach will be needed. Perhaps spying on the calls to fetch to observe the processed URL.

Thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.