-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Question mark eaten from request URL if no params specified #2912
Copy link
Copy link
Closed
Description
Here is an URL with question mark included, but without any parameters:
url='http://server.com/api/item.json?'
That URL (w/ question mark) controls server response in such way that it allows to request certain metadata about an item, instead of representation of an item iteself:
import urllib3
http = urllib3.PoolManager()
r = http.request('GET', url)
print (r.data)
{ "ItemMetadata" : { ... }}
The above works well.
Requests, however, eat-or-skip the question mark if the params argument is missing/None/{}, so my request is responded with the resource representation, instead of the metadata:
from requests import get
r = get(url, stream=True)
print(r.text)
{ "Item" : { ... }}
That seem to indicate a bug in URL parsing.
Reactions are currently unavailable