direct_client gen_headers is inconsistent
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Object Storage (swift) |
New
|
Wishlist
|
Unassigned |
Bug Description
consumers of direct_client should be able to reliably over-ride the user-agent header and set x-timestamp
We should replace gen_headers with a more useful utility and make sure all direct_client methods accept the headers kwarg
Something like this:
def prepare_
"""
Get the headers ready for a request. All requests should have a User-Agent
string, but if one is passed in don't over-write it. Not all requests will
need an X-Timestamp, but if one is passed in do not over-write it.
:param headers: dict or None, base for HTTP headers
:param ensure_ts: boolean, should be True for any "unsafe" HTTP request
:returns: HeaderKeyDict based on headers and ready for the request
"""
hdrs_out = HeaderKeyDict(
if ensure_ts and 'x-timestamp' not in hdrs_out:
if 'user-agent' not in hdrs_out:
return hdrs_out
... and all the tests that go with it
> make sure all direct_client methods accept the headers kwarg
At time of writing (around 2.19.0), the following methods need this:
- direct_get_account head_container
- direct_
Separately, do we not have direct_head_account or direct_post_account functions?