0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-06-18 18:48:31 +02:00
synapse/tests/http
Eric Eastwood 1bf2832714
Indicate what endpoint came back with a JSON response we were unable to parse (#14097)
**Before:**
```
WARNING - POST-11 - Unable to parse JSON: Expecting value: line 1 column 1 (char 0) (b'')
```

**After:**
```
WARNING - POST-11 - Unable to parse JSON from POST /_matrix/client/v3/join/%21ZlmJtelqFroDRJYZaq:hs1?server_name=hs1 response: Expecting value: line 1 column 1 (char 0) (b'')
```

---

It's possible to figure out which endpoint these warnings were coming from before but you had to follow the request ID `POST-11` to the log line that says `Completed request [...]`. Including this key information next to the JSON parsing error makes it much easier to reason whether it matters or not.

```
2022-09-29T08:23:25.7875506Z synapse_main | 2022-09-29 08:21:10,336 - synapse.http.matrixfederationclient - 299 - INFO - POST-11 - {GET-O-13} [hs1] Completed request: 200 OK in 0.53 secs, got 450 bytes - GET matrix://hs1/_matrix/federation/v1/make_join/%21ohtKoQiXlPePSycXwp%3Ahs1/%40charlie%3Ahs2?ver=1&ver=2&ver=3&ver=4&ver=5&ver=6&ver=org.matrix.msc2176&ver=7&ver=8&ver=9&ver=org.matrix.msc3787&ver=10&ver=org.matrix.msc2716v4
```


---

As a note, having no `body` is normal for the `/join` endpoint and it can handle it.

0c853e0970/synapse/rest/client/room.py (L398-L403)

Alternatively we could remove these extra logs but they are probably more usually helpful to figure out what went wrong.
2022-10-07 11:39:45 -05:00
..
federation Replace assertEquals and friends with non-deprecated versions. (#12092) 2022-02-28 07:12:29 -05:00
server Cancel the processing of key query requests when they time out. (#13680) 2022-09-07 12:03:32 +01:00
__init__.py Remove redundant "coding: utf-8" lines (#9786) 2021-04-14 15:34:27 +01:00
ca.crt Tests for SSL certs for federation connections 2019-06-10 16:14:20 +01:00
ca.key Tests for SSL certs for federation connections 2019-06-10 16:14:20 +01:00
server.key Tests for SSL certs for federation connections 2019-06-10 16:14:20 +01:00
test_additional_resource.py Add reactor to SynapseRequest and fix up types. (#10868) 2021-09-24 11:01:25 +01:00
test_client.py Use mock from the stdlib. (#9772) 2021-04-09 13:44:38 -04:00
test_endpoint.py Prevent the media store from writing outside of the configured directory 2021-11-19 13:39:15 +00:00
test_matrixfederationclient.py Fix destination_is errors seen in sentry. (#13041) 2022-06-14 18:28:26 +01:00
test_proxyagent.py support federation queries through http connect proxy (#10475) 2021-08-11 15:34:59 +01:00
test_servlet.py Indicate what endpoint came back with a JSON response we were unable to parse (#14097) 2022-10-07 11:39:45 -05:00
test_simple_client.py Remove redundant "coding: utf-8" lines (#9786) 2021-04-14 15:34:27 +01:00
test_site.py Add some type hints to tests files (#12833) 2022-05-23 11:23:26 +00:00