-
Notifications
You must be signed in to change notification settings - Fork 66
Closed
Milestone
Description
Describe the bug
When using the Header type for a variable, it is always added to the request, even if the default of None is used
To Reproduce
import uplink
class HTTPBin(uplink.Consumer):
@uplink.returns.json
@uplink.get('headers')
def headers(self, foo: uplink.Header = None):
pass
bin = HTTPBin(base_url='https://httpbin.org')
print(bin.headers())Result: {'headers': {'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate', 'Foo': 'None', 'Host': 'httpbin.org', 'User-Agent': 'python-requests/2.20.1'}}
Expected behavior
When the default value of None is used, the header should not be added to the request, as that is the expected behavior. It is also how Query works and it should be consistent.
Metadata
Metadata
Assignees
Labels
No labels