Skip to content

Commit 1254b41

Browse files
authored
Enable header matching (#1004)
Change the tests to enable header matching, and pass all headers in accepts.
1 parent 4613292 commit 1254b41

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

src/datadog_api_client/api_client.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -463,15 +463,7 @@ def select_header_accept(self, accepts):
463463
:param accepts: List of headers.
464464
:return: Accept (e.g. application/json).
465465
"""
466-
if not accepts:
467-
return
468-
469-
accepts = [x.lower() for x in accepts]
470-
471-
if "application/json" in accepts:
472-
return "application/json"
473-
else:
474-
return ", ".join(accepts)
466+
return ", ".join(accepts)
475467

476468
def select_header_content_type(self, content_types):
477469
"""Returns `Content-Type` based on an array of content_types provided.

tests/conftest.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,8 @@ def disable_recording(request):
277277
@pytest.fixture
278278
def vcr_config():
279279
config = dict(
280-
filter_headers=("DD-API-KEY", "DD-APPLICATION-KEY"),
281-
filter_query_parameters=("api_key", "application_key"),
282-
match_on=["method", "scheme", "host", "port", "path", "query", "body"],
280+
filter_headers=("DD-API-KEY", "DD-APPLICATION-KEY", "User-Agent", "Accept-Encoding"),
281+
match_on=["method", "scheme", "host", "port", "path", "query", "body", "headers"],
283282
)
284283
if tracer:
285284
from urllib.parse import urlparse

0 commit comments

Comments
 (0)