Home / Function/ test_default_headers_option() — anthropic-sdk-python Function Reference

test_default_headers_option() — anthropic-sdk-python Function Reference

Architecture documentation for the test_default_headers_option() function in test_client.py from the anthropic-sdk-python codebase.

Function python AnthropicClient SyncAPI calls 1 called by 1

Entity Profile

Dependency Diagram

graph TD
  f7ed3ab5_ea7f_8f06_dbd8_dd621f298f75["test_default_headers_option()"]
  d53b6c34_1743_a045_4be1_3554ab153964["TestAnthropic"]
  f7ed3ab5_ea7f_8f06_dbd8_dd621f298f75 -->|defined in| d53b6c34_1743_a045_4be1_3554ab153964
  36086efe_424b_0d95_82b3_f6464b5b786f["test_default_headers_option()"]
  36086efe_424b_0d95_82b3_f6464b5b786f -->|calls| f7ed3ab5_ea7f_8f06_dbd8_dd621f298f75
  36086efe_424b_0d95_82b3_f6464b5b786f["test_default_headers_option()"]
  f7ed3ab5_ea7f_8f06_dbd8_dd621f298f75 -->|calls| 36086efe_424b_0d95_82b3_f6464b5b786f
  style f7ed3ab5_ea7f_8f06_dbd8_dd621f298f75 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_client.py lines 379–401

    def test_default_headers_option(self) -> None:
        test_client = Anthropic(
            base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"}
        )
        request = test_client._build_request(FinalRequestOptions(method="get", url="/foo"))
        assert request.headers.get("x-foo") == "bar"
        assert request.headers.get("x-stainless-lang") == "python"

        test_client2 = Anthropic(
            base_url=base_url,
            api_key=api_key,
            _strict_response_validation=True,
            default_headers={
                "X-Foo": "stainless",
                "X-Stainless-Lang": "my-overriding-header",
            },
        )
        request = test_client2._build_request(FinalRequestOptions(method="get", url="/foo"))
        assert request.headers.get("x-foo") == "stainless"
        assert request.headers.get("x-stainless-lang") == "my-overriding-header"

        test_client.close()
        test_client2.close()

Subdomains

Frequently Asked Questions

What does test_default_headers_option() do?
test_default_headers_option() is a function in the anthropic-sdk-python codebase, defined in tests/test_client.py.
Where is test_default_headers_option() defined?
test_default_headers_option() is defined in tests/test_client.py at line 379.
What does test_default_headers_option() call?
test_default_headers_option() calls 1 function(s): test_default_headers_option.
What calls test_default_headers_option()?
test_default_headers_option() is called by 1 function(s): test_default_headers_option.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free