Skip to content

Commit 6a94a48

Browse files
committed
No longer gzip compressed query [skip ci]
1 parent c3d0cc9 commit 6a94a48

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

src/mock_vws/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def __enter__(self) -> 'MockVWS':
127127
mock.register_uri(
128128
method=http_method,
129129
url=re.compile(url_pattern),
130-
content=getattr(mock_vwq_api, route.route_name),
130+
text=getattr(mock_vwq_api, route.route_name),
131131
headers=headers,
132132
)
133133

src/mock_vws/_mock_web_query_api.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def query(
7575
self,
7676
request: _RequestObjectProxy, # pylint: disable=unused-argument
7777
context: _Context,
78-
) -> bytes:
78+
) -> str:
7979
"""
8080
Perform an image recognition query.
8181
"""
@@ -86,8 +86,6 @@ def query(
8686
'query_id': uuid.uuid4().hex,
8787
}
8888

89-
text = json_dump(body)
90-
context.headers['Content-Encoding'] = 'gzip'
91-
value = gzip.compress(text.encode())
89+
value = json_dump(body)
9290
context.headers['Content-Length'] = str(len(value))
9391
return value

tests/mock_vws/test_query.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ def assert_success(response: Response) -> None:
4141
assert response.json()['result_code'] == 'Success'
4242
response_header_keys = {
4343
'Connection',
44-
'Content-Encoding',
4544
'Content-Type',
4645
'Date',
4746
'Server',
@@ -65,7 +64,6 @@ def assert_success(response: Response) -> None:
6564
assert response.headers.keys() == response_header_keys
6665

6766
assert response.headers['Connection'] == 'keep-alive'
68-
assert response.headers['Content-Encoding'] == 'gzip'
6967
assert response.headers['Content-Type'] == 'application/json'
7068
assert_valid_date_header(response=response)
7169
assert response.headers['Server'] == 'nginx'

0 commit comments

Comments
 (0)