@@ -296,7 +296,7 @@ def read_image() -> Response:
296
296
assert headers ["Content-Encoding" ] == "gzip"
297
297
298
298
299
- def test_compress_no_accept_encoding ():
299
+ def test_compress_no_accept_encoding_null_headers ():
300
300
# GIVEN a function with compress=True
301
301
# AND the request has no "Accept-Encoding" set to include gzip
302
302
app = ApiGatewayResolver ()
@@ -314,6 +314,24 @@ def return_text() -> Response:
314
314
assert result ["body" ] == expected_value
315
315
316
316
317
+ def test_compress_no_accept_encoding_null_headers ():
318
+ # GIVEN a function with compress=True
319
+ # AND the request has no headers
320
+ app = ApiGatewayResolver ()
321
+ expected_value = "Foo"
322
+
323
+ @app .get ("/my/path" , compress = True )
324
+ def return_text () -> Response :
325
+ return Response (200 , content_types .TEXT_PLAIN , expected_value )
326
+
327
+ # WHEN calling the event handler
328
+ result = app ({"path" : "/my/path" , "httpMethod" : "GET" , "headers" : None }, None )
329
+
330
+ # THEN don't perform any gzip compression
331
+ assert result ["isBase64Encoded" ] is False
332
+ assert result ["body" ] == expected_value
333
+
334
+
317
335
def test_cache_control_200 ():
318
336
# GIVEN a function with cache_control set
319
337
app = ApiGatewayResolver ()
0 commit comments