Skip to content

Commit 4611f12

Browse files
Merge pull request #535 from adamtheturtle/fix-test-query
Remove all traces of gzip from the query API
2 parents 96305f2 + 2574061 commit 4611f12

File tree

3 files changed

+3
-8
lines changed

3 files changed

+3
-8
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 & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
https://library.vuforia.com/articles/Solution/How-To-Perform-an-Image-Recognition-Query
66
"""
77

8-
import gzip
98
import uuid
109
from typing import Callable, List, Set
1110

@@ -75,7 +74,7 @@ def query(
7574
self,
7675
request: _RequestObjectProxy, # pylint: disable=unused-argument
7776
context: _Context,
78-
) -> bytes:
77+
) -> str:
7978
"""
8079
Perform an image recognition query.
8180
"""
@@ -86,8 +85,6 @@ def query(
8685
'query_id': uuid.uuid4().hex,
8786
}
8887

89-
text = json_dump(body)
90-
context.headers['Content-Encoding'] = 'gzip'
91-
value = gzip.compress(text.encode())
88+
value = json_dump(body)
9289
context.headers['Content-Length'] = str(len(value))
9390
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)