mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-23 10:40:23 +00:00
During testing, ensure we're not getting text/html unexpectedly.
This commit is contained in:
parent
6d961eada9
commit
5f19605075
@ -443,11 +443,20 @@ class StorageClient(object):
|
||||
kwargs["data"] = dumps(message_to_serialize)
|
||||
headers.addRawHeader("Content-Type", CBOR_MIME_TYPE)
|
||||
|
||||
return await self._treq.request(
|
||||
response = await self._treq.request(
|
||||
method, url, headers=headers, timeout=timeout, **kwargs
|
||||
)
|
||||
|
||||
async def decode_cbor(self, response, schema: Schema) -> object:
|
||||
if self.TEST_MODE_REGISTER_HTTP_POOL is not None:
|
||||
if response.code != 404:
|
||||
# We're doing API queries, HTML is never correct except in 404, but
|
||||
# it's the default for Twisted's web server so make sure nothing
|
||||
# unexpected happened.
|
||||
assert get_content_type(response.headers) != "text/html"
|
||||
|
||||
return response
|
||||
|
||||
async def decode_cbor(self, response: IResponse, schema: Schema) -> object:
|
||||
"""Given HTTP response, return decoded CBOR body."""
|
||||
with start_action(action_type="allmydata:storage:http-client:decode-cbor"):
|
||||
if response.code > 199 and response.code < 300:
|
||||
|
Loading…
x
Reference in New Issue
Block a user