DELETE redirect not supported [urllib.request]
Open
Nobody has claimed this yet.
type-bug
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
Bug description:
Compare node.js:
> response = await fetch('http://www.xlog.ch/echo/delete?foo1=bar1&foo2=bar2',
... {method:'DELETE'}); response.url
'https://www.xlog.ch/echo/delete?foo1=bar1&foo2=bar2'
With CPython:
request = urllib.request.Request('http://www.xlog.ch/echo/delete?foo1=bar1&foo2=bar2', method='DELETE')
response = urllib.request.urlopen(request)
urllib.error.HTTPError: HTTP Error 302:
I believe node.js fetch() redirects, whereas CPython thinks
302 is an error, since the method is neither HEAD, GET or PUT.
But its probably not an error, all methods are allowed:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with urllib.request and trace how an HTTP 302 response is handled for methods other than HEAD, GET, and PUT. Compare that path with the documented redirect behavior and the provided DELETE example; done means the intended DELETE redirect behavior is covered by a regression test without breaking existing redirect handling.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100