Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
net/http: redirect code is not handled for DELETE requests. #13994
redirection is only handled for GET, HEAD, PUT and POST requests. But not for 'DELETE' , this leads to an issue where in a 'DELETE' request with proper response from the server doesn't honor redirect.
Following code reproduces this problem.
Now running this client against the server.go
The problem seems to be in
Is there a specific reason why DELETE is not handled?.
Tested with curl seems to work fine
Also verified in RFC7231 - https://tools.ietf.org/html/rfc7231#section-4.3.5, doesn't talk anything specific about redirects for 'DELETE'.
Thanks for your inputs.
I don't think CL 18706 is correct.
DELETE is not a safe method: https://tools.ietf.org/html/rfc7231#section-4.2.1
It's not correct to treat DELETE the same as a GET or HEAD.
Such is the case for PUT and POST as well, wouldn't it be safe to allow a way to set unsafe Methods to be redirected if necessary? and by default only do "GET" and "HEAD".