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

302 Redirect with Got http-client is not re-written as GET request. #1665

Open
exoup opened this issue Jan 19, 2025 · 0 comments
Open

302 Redirect with Got http-client is not re-written as GET request. #1665

exoup opened this issue Jan 19, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@exoup
Copy link

exoup commented Jan 19, 2025

Describe the bug
When making a POST/PUT/non-GET request that returns a 302 redirect utilizing the Got http-client, Thunder Client will not rewrite the request as a GET, frequently causing a 404/error.

When performing the same with Axios, it does rewrite the request as GET. (Which is what the browser and most clients (postman, etc) do.)

To Reproduce
Using the Got http-client, make a request to a POST endpoint that returns a 302 redirect to a GET endpoint.

import { Hono } from "hono";
const app = new Hono();
app.get('/get', (c) => c.text('Hello!'));
app.post('/logout', (c) => c.redirect('/', 302));

Request POST /logout and receive 404 instead of 200.

Expected behavior
By default, other clients (Postman, etc) will typically rewrite the request as GET (default Axios behavior), so you'd receive Hello! from the example above.

Would expect requests made with Got to follow this behavior.
It is the default behavior of Got NOT to do this per HTTP spec and their docs but it can be changed.
It looks like it was attempted to be addressed #388 but was not.

Seems like this could be resolved by setting the methodRewriting boolean to true.

Platform:

  • extension version: v2.33.2

Are you using the free version/paid version/trial:
Free

@exoup exoup added the bug Something isn't working label Jan 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant