Skip to content

Fix caller-provided User-Agent headers being overwritten - #808

Open
vamsikrishna-66 wants to merge 1 commit into
ollama:mainfrom
vamsikrishna-66:fix/custom-client-headers
Open

vamsikrishna-66 wants to merge 1 commit into
ollama:mainfrom
vamsikrishna-66:fix/custom-client-headers

Conversation

@vamsikrishna-66

Copy link
Copy Markdown

Summary

Client(headers={'User-Agent': 'example-app/1.0'}) and the equivalent AsyncClient call currently replace the supplied value with Ollama's default. Apply that default only when the caller did not supply a User-Agent. Header matching remains case-insensitive, and the existing JSON header and authorization handling stay as before.

Verification

  • All six new regression cases fail on the base and pass with the fix. They cover both clients and three spellings of the header.
  • Full test suite and doctests: 128 passed on Python 3.12.
  • Ruff lint, Ruff formatting, and git diff --check passed.

AI assistance

Codex prepared the patch and ran the tests.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant