Skip to content

return the exact data to be sent to the client from webserver #7669

Discussion options

You must be logged in to vote

As an HTTP library, it's designed to abstract away the HTTP parts, so it's not really designed to send exact responses.

Without hacking things, the version comes from the request request.version, so if that's 1.0, then you should get the correct version. The status code defaults to 200, and you can explicitly set the reason (web.Response(reason="OK")).

Several default headers will be added though. A hacky way to ensure none are included may be to subclass Response and then replace _write_headers(), removing the headers from the last line: https://github.com/aio-libs/aiohttp/blob/master/aiohttp/web_response.py#L416
Or just doing:

    async def _write_headers(self) -> None:
        self._he…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by RainerZufall187
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants