mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Set a content-length for JSON responses
This commit is contained in:
parent
78edb47cc5
commit
773de09774
@ -233,6 +233,7 @@ def respond_with_json_bytes(request, code, json_bytes, send_cors=False,
|
|||||||
request.setResponseCode(code, message=response_code_message)
|
request.setResponseCode(code, message=response_code_message)
|
||||||
request.setHeader(b"Content-Type", b"application/json")
|
request.setHeader(b"Content-Type", b"application/json")
|
||||||
request.setHeader(b"Server", AGENT_NAME)
|
request.setHeader(b"Server", AGENT_NAME)
|
||||||
|
request.setHeader(b"Content-Length", b"%d" % len(json_bytes))
|
||||||
|
|
||||||
if send_cors:
|
if send_cors:
|
||||||
request.setHeader("Access-Control-Allow-Origin", "*")
|
request.setHeader("Access-Control-Allow-Origin", "*")
|
||||||
|
Loading…
Reference in New Issue
Block a user