diff --git a/sdk/core/azure-core/tests/async_tests/test_rest_headers_async.py b/sdk/core/azure-core/tests/async_tests/test_rest_headers_async.py index 7fcf6c153fc2..3b61c59b69d5 100644 --- a/sdk/core/azure-core/tests/async_tests/test_rest_headers_async.py +++ b/sdk/core/azure-core/tests/async_tests/test_rest_headers_async.py @@ -12,6 +12,7 @@ # flask returns these response headers, which we don't really need for these following tests RESPONSE_HEADERS_TO_IGNORE = [ + "Connection", "Content-Type", "Content-Length", "Server", @@ -24,7 +25,7 @@ async def _get_response_headers(request): response = await client.send_request(request) response.raise_for_status for header in RESPONSE_HEADERS_TO_IGNORE: - response.headers.pop(header) + response.headers.pop(header, None) return response.headers return _get_response_headers diff --git a/sdk/core/azure-core/tests/test_rest_headers.py b/sdk/core/azure-core/tests/test_rest_headers.py index cc2f564e70c1..db77b9751cfb 100644 --- a/sdk/core/azure-core/tests/test_rest_headers.py +++ b/sdk/core/azure-core/tests/test_rest_headers.py @@ -21,6 +21,7 @@ def _get_request_headers(header_value): # flask returns these response headers, which we don't really need for these following tests RESPONSE_HEADERS_TO_IGNORE = [ + "Connection", "Content-Type", "Content-Length", "Server", @@ -33,7 +34,7 @@ def _get_response_headers(request): response = client.send_request(request) response.raise_for_status for header in RESPONSE_HEADERS_TO_IGNORE: - response.headers.pop(header) + response.headers.pop(header, None) return response.headers return _get_response_headers