Header Propagation Middleware
Middleware for propagating headers from incoming requests to outgoing requests for FastAPI.
Installation
pip install header-propagation-middleware
Setup
To setup the middleware, you need to add it to your FastAPI app.
Adding Middleware
from header_propagation_middleware import HeaderPropagationMiddleware
app = FastAPI()
app.add_middleware(HeaderPropagationMiddleware,header_names=["header1","header2"])
Configurable middleware argument
header_names
- Type:
List[str] - Default:
[] - Description: The list of headers to propagate.
Accessing propagated headers
You can access the propagated headers using the propagated_headers object.
from header_propagation_middleware import propagated_headers
propagated_headers.get()
propagated_headers
- Type:
dict - Default:
{} - Description: The dictionary of propagated headers.
Tests
Running test
python -m pytest
Running test with coverage report
python -m pytest --cov --cov-report=html:reports/html_dir
Metadata
Release files for header-propagation 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| header_propagation-1.0.0.tar.gz | 4.0 kB | Without provenance | Details for header_propagation-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| header_propagation-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for header_propagation-1.0.0-py3-none-any.whl |
Total release size: 8.1 kB
Release files / header_propagation-1.0.0.tar.gz
| Download URL | header_propagation-1.0.0.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2f6c7d150391660ca4c1c6cb871e9ec6b4adca6aaab77f22580d233aacede2b8
|
|
BLAKE2b-256 checksum How to use checksums |
95dd37c25549106e3d9373f1e4d19c197bd3619173f6e33d25847791b6523caa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.0
|
Release files / header_propagation-1.0.0-py3-none-any.whl
| Download URL | header_propagation-1.0.0-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dfa901061ec5aa822d6d78175b0c3e905fd9e615cafdc2f50b68df29f6789811
|
|
BLAKE2b-256 checksum How to use checksums |
340f910402e33454ae1ae4100c63dedc7efa77e3682988ab315d8848d26fcf1f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.0
|
Security for header-propagation 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.