snok / asgi-correlation-id

Request ID propagation for ASGI apps
MIT License
370 stars 29 forks source link

latest v1.1.3 breaks headers #29

Closed AndreyKashirinArammeem closed 2 years ago

AndreyKashirinArammeem commented 2 years ago

Middleware currupts headers

1.1.2
starlette/testclient.py(207)send()
-> raw_kwargs["headers"] = [
(Pdb) pp message
{'headers': [(b'content-length', b'181'),
             (b'content-type', b'application/json'),
             (b'x-request-id', b'f93cb2c8bd49462697e9035887fa496d'),
             (b'access-control-expose-headers', b'X-Request-ID')],
...

1.1.3
> starlette/testclient.py(207)send()
-> raw_kwargs["headers"] = [
(Pdb) pp message
{'headers': [('content-length', '181'),
             ('content-type', 'application/json'),
             (b'X-Request-ID', b'6200fab6d55d4ce4959bb4ef916cf47b'),
             (b'Access-Control-Expose-Headers', b'X-Request-ID')],
...

Note the difference in first two headers

sondrelg commented 2 years ago

Thanks for reporting this @AndreyKashirinArammeem, I'll see if I can get a fix out shortly.

Do you have an easy way for me to replicate the issue locally?

sondrelg commented 2 years ago

Alternatively, would you be able to verify whether it works again if you install with

pip install git+https://github.com/snok/asgi-correlation-id.git@74b59f77905662c7b578e18371c1294eed7387f6