MCPcopy Create free account
hub / github.com/requests-cache/requests-cache / test_match_headers

Function test_match_headers

tests/unit/test_session.py:334–345  ·  view source on GitHub ↗

With match_headers, requests with different headers should have different cache keys

(mock_session)

Source from the content-addressed store, hash-verified

332
333
334def test_match_headers(mock_session):
335 """With match_headers, requests with different headers should have different cache keys"""
336 mock_session.settings.match_headers = True
337 headers_list = [
338 {'Accept': 'application/json'},
339 {'Accept': 'text/xml'},
340 {'Accept': 'custom'},
341 None,
342 ]
343 for headers in headers_list:
344 assert mock_session.get(MOCKED_URL, headers=headers).from_cache is False
345 assert mock_session.get(MOCKED_URL, headers=headers).from_cache is True
346
347
348def test_match_headers__normalize(mock_session):

Callers

nothing calls this directly

Calls 1

getMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…