mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-05 14:44:55 -04:00
Fix logging of incorrect status codes for disconnected requests (#12580)
The status code of requests must always be set, regardless of client disconnection, otherwise they will always be logged as 200!. Broken for `respond_with_json` inf48792eec4
. Broken for `respond_with_json_bytes` in3e58ce72b4
. Broken for `respond_with_html_bytes` inea26e9a98b
. Signed-off-by: Sean Quah <seanq@element.io>
This commit is contained in:
parent
629aa51743
commit
0b684b59e5
4 changed files with 36 additions and 5 deletions
|
@ -349,4 +349,16 @@ class SamlHandlerTestCase(HomeserverTestCase):
|
|||
|
||||
def _mock_request():
|
||||
"""Returns a mock which will stand in as a SynapseRequest"""
|
||||
return Mock(spec=["getClientIP", "getHeader", "_disconnected"])
|
||||
mock = Mock(
|
||||
spec=[
|
||||
"finish",
|
||||
"getClientIP",
|
||||
"getHeader",
|
||||
"setHeader",
|
||||
"setResponseCode",
|
||||
"write",
|
||||
]
|
||||
)
|
||||
# `_disconnected` musn't be another `Mock`, otherwise it will be truthy.
|
||||
mock._disconnected = False
|
||||
return mock
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue