Skip to content

Question mark eaten from request URL if no params specified #2912

@mloskot

Description

@mloskot

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.

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions