mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-16 07:33:50 +01:00
Fix syntax issues
This commit is contained in:
parent
09626bfd39
commit
5526b054aa
1 changed files with 10 additions and 7 deletions
|
@ -190,6 +190,7 @@ class MatrixFederationHttpClient(object):
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def _send_request_with_optional_trailing_slash(
|
def _send_request_with_optional_trailing_slash(
|
||||||
|
self,
|
||||||
request,
|
request,
|
||||||
try_trailing_slash_on_400=False,
|
try_trailing_slash_on_400=False,
|
||||||
backoff_on_404=False,
|
backoff_on_404=False,
|
||||||
|
@ -215,7 +216,7 @@ class MatrixFederationHttpClient(object):
|
||||||
Deferred[twisted.web.client.Response]: resolves with the HTTP
|
Deferred[twisted.web.client.Response]: resolves with the HTTP
|
||||||
response object on success.
|
response object on success.
|
||||||
"""
|
"""
|
||||||
response = self._send_request(**kwargs)
|
response = yield self._send_request(**kwargs)
|
||||||
|
|
||||||
if not try_trailing_slash_on_400:
|
if not try_trailing_slash_on_400:
|
||||||
defer.returnValue(response)
|
defer.returnValue(response)
|
||||||
|
@ -225,6 +226,9 @@ class MatrixFederationHttpClient(object):
|
||||||
self.hs.get_reactor(), self.default_timeout, request, response,
|
self.hs.get_reactor(), self.default_timeout, request, response,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
logger.info(" *** BODY IS *** ")
|
||||||
|
logger.info(body)
|
||||||
|
|
||||||
# Retry with a trailing slash if we received a 400 with
|
# Retry with a trailing slash if we received a 400 with
|
||||||
# 'M_UNRECOGNIZED' which some endpoints can return when omitting a
|
# 'M_UNRECOGNIZED' which some endpoints can return when omitting a
|
||||||
# trailing slash on Synapse <=v0.99.2.
|
# trailing slash on Synapse <=v0.99.2.
|
||||||
|
@ -588,15 +592,10 @@ class MatrixFederationHttpClient(object):
|
||||||
request, try_trailing_slash_on_400, backoff_on_404, **send_request_args,
|
request, try_trailing_slash_on_400, backoff_on_404, **send_request_args,
|
||||||
)
|
)
|
||||||
|
|
||||||
# If enabled, retry with a trailing slash if we received a 400
|
|
||||||
if try_trailing_slash_on_400 and response.code == 400:
|
|
||||||
args["path"] += "/"
|
|
||||||
|
|
||||||
response = yield self._send_request(**send_request_args)
|
|
||||||
|
|
||||||
body = yield _handle_json_response(
|
body = yield _handle_json_response(
|
||||||
self.hs.get_reactor(), self.default_timeout, request, response,
|
self.hs.get_reactor(), self.default_timeout, request, response,
|
||||||
)
|
)
|
||||||
|
|
||||||
defer.returnValue(body)
|
defer.returnValue(body)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
@ -713,6 +712,10 @@ class MatrixFederationHttpClient(object):
|
||||||
request, try_trailing_slash_on_400, False, **send_request_args,
|
request, try_trailing_slash_on_400, False, **send_request_args,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
body = yield _handle_json_response(
|
||||||
|
self.hs.get_reactor(), self.default_timeout, request, response,
|
||||||
|
)
|
||||||
|
|
||||||
defer.returnValue(body)
|
defer.returnValue(body)
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
|
|
Loading…
Reference in a new issue