You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
🐣 Is your feature request related to a problem? Please describe.
Feature request: TraceConfig does not allow for tracing "headers sent" stage, while it is quite often useful to verify them on-the-wire.
💡 Describe the solution you'd like
Implement on_headers_sent signal which provides exact on-the wire headers buffer sent, similar to on_request_chunk_sent.
The implementation should be quite straightforward:
Define a new signal in TraceConfig
Provide the callback as on_headers_sent to StreamWriter constructor, similar like on_chunk_sent is provided
Call the callback in write_headers, providing the serialized buf.
❓ Describe alternatives you've considered
Workaround to see on-the-wire headers seems to be possible only with unittest.patch, or with monkey-copying whole ClientRequest.send lenghty function into a child class, adding logging there and providing this class to ClientSession.
📋 Additional context
When performing some API calls to remote server requiring very specific or complicated headers, it is useful to compare exact headers sent to e.g. what is sent through postman or browser. Not having access to textual representation of headers make this tedious. Also such a feature would allow for validating if cookie headers are correctly set by aiohttp.ClientSession.
The text was updated successfully, but these errors were encountered:
🐣 Is your feature request related to a problem? Please describe.
Feature request:
TraceConfig
does not allow for tracing "headers sent" stage, while it is quite often useful to verify them on-the-wire.💡 Describe the solution you'd like
Implement on_headers_sent signal which provides exact on-the wire headers buffer sent, similar to on_request_chunk_sent.
The implementation should be quite straightforward:
TraceConfig
on_headers_sent
toStreamWriter
constructor, similar likeon_chunk_sent
is providedbuf
.❓ Describe alternatives you've considered
Workaround to see on-the-wire headers seems to be possible only with
unittest.patch
, or with monkey-copying wholeClientRequest.send
lenghty function into a child class, adding logging there and providing this class toClientSession
.Here is a sample workaround with patching:
📋 Additional context
When performing some API calls to remote server requiring very specific or complicated headers, it is useful to compare exact headers sent to e.g. what is sent through postman or browser. Not having access to textual representation of headers make this tedious. Also such a feature would allow for validating if cookie headers are correctly set by
aiohttp.ClientSession
.The text was updated successfully, but these errors were encountered: