return the exact data to be sent to the client from webserver #7669
-
i need to send the client this |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
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 Several default headers will be added though. A hacky way to ensure none are included may be to subclass Response and then replace
|
Beta Was this translation helpful? Give feedback.
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's1.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#L416Or just doing: