Explicitly tell the server that the client accepts CBOR.

This commit is contained in:
Itamar Turner-Trauring 2022-03-14 11:20:23 -04:00
parent 106cc708a0
commit 0aa8089d81

View File

@ -99,6 +99,8 @@ class StorageClient(object):
into corresponding HTTP headers. into corresponding HTTP headers.
""" """
headers = self._get_headers(headers) headers = self._get_headers(headers)
# Add secrets:
for secret, value in [ for secret, value in [
(Secrets.LEASE_RENEW, lease_renew_secret), (Secrets.LEASE_RENEW, lease_renew_secret),
(Secrets.LEASE_CANCEL, lease_cancel_secret), (Secrets.LEASE_CANCEL, lease_cancel_secret),
@ -110,6 +112,10 @@ class StorageClient(object):
"X-Tahoe-Authorization", "X-Tahoe-Authorization",
b"%s %s" % (secret.value.encode("ascii"), b64encode(value).strip()), b"%s %s" % (secret.value.encode("ascii"), b64encode(value).strip()),
) )
# Note we can accept CBOR:
headers.addRawHeader("Accept", CBOR_MIME_TYPE)
return self._treq.request(method, url, headers=headers, **kwargs) return self._treq.request(method, url, headers=headers, **kwargs)