File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -59,3 +59,19 @@ def test_conforms_to(self):
5959
6060 # Check that this does not raise an exception
6161 assert conformant_io .conforms_to (ConformanceClasses .CORE )
62+
63+ def test_custom_headers (self , requests_mock ):
64+ """Checks that headers passed to the init method are added to requests."""
65+ header_name = "x-my-header"
66+ header_value = "Some Value"
67+ url = "https://some-url.com/some-file.json"
68+ stac_api_io = StacApiIO (headers = {header_name : header_value })
69+
70+ requests_mock .get (url , status_code = 200 , json = {})
71+
72+ stac_api_io .read_json (url )
73+
74+ history = requests_mock .request_history
75+ assert len (history ) == 1
76+ assert header_name in history [0 ].headers
77+ assert history [0 ].headers [header_name ] == header_value
You can’t perform that action at this time.
0 commit comments