Skip to content

feat: add default_headers support to config#1831

Open
Marias03 wants to merge 4 commits intohttpie:masterfrom
Marias03:feature/default-headers
Open

feat: add default_headers support to config#1831
Marias03 wants to merge 4 commits intohttpie:masterfrom
Marias03:feature/default-headers

Conversation

@Marias03
Copy link
Copy Markdown

Closes #1660

What does this PR do?

Adds support for default_headers in HTTPie's config file.
Users can now set headers that will be automatically included in every request.

How to use it?

Add to your config.json:

{
    "default_headers": {
        "Content-Type": "application/json"
    }
}

These headers can still be overridden per-request by the user.

Changes

  • httpie/config.py: Added default_headers to Config.DEFAULTS and a new property
  • httpie/client.py: Applied default_headers from config in make_request_kwargs
  • tests/test_config.py: Added two tests for the new feature

@Marias03 Marias03 mentioned this pull request Apr 21, 2026
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.

Set Default Header

1 participant