Skip to content

Python: duplicate User-Agent headers when caller passes lowercase user-agent #8520

Description

Motivation & Context

callers that pass a lowercase user-agent in default_headers (reachable through OpenAI client options) end up sending two User-Agent lines, because the prepend logic checks "User-Agent" in headers with exact casing and then adds its own.

Reproduction

prepend_agent_framework_to_user_agent({"user-agent": "my-app/1.0"})
# -> both "User-Agent: agent-framework/..." and the original lowercase one survive
# httpx sends duplicate header lines

Expected behavior

header detection is case-insensitive (HTTP headers are case-insensitive); the framework value prepends to the caller's UA instead of duplicating it.

env: python main

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    pythonUsage: [Issues, PRs], Target: PythontriageUsage: [Issues], Target: All issues that still need to be triaged

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions