MSC4108 implementation (#17056)
Co-authored-by: Hugh Nimmo-Smith <hughns@element.io> Co-authored-by: Hugh Nimmo-Smith <hughns@users.noreply.github.com> Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
This commit is contained in:
@@ -351,6 +351,7 @@ def make_request(
|
||||
request: Type[Request] = SynapseRequest,
|
||||
shorthand: bool = True,
|
||||
federation_auth_origin: Optional[bytes] = None,
|
||||
content_type: Optional[bytes] = None,
|
||||
content_is_form: bool = False,
|
||||
await_result: bool = True,
|
||||
custom_headers: Optional[Iterable[CustomHeaderType]] = None,
|
||||
@@ -373,6 +374,8 @@ def make_request(
|
||||
with the usual REST API path, if it doesn't contain it.
|
||||
federation_auth_origin: if set to not-None, we will add a fake
|
||||
Authorization header pretenting to be the given server name.
|
||||
content_type: The content-type to use for the request. If not set then will default to
|
||||
application/json unless content_is_form is true.
|
||||
content_is_form: Whether the content is URL encoded form data. Adds the
|
||||
'Content-Type': 'application/x-www-form-urlencoded' header.
|
||||
await_result: whether to wait for the request to complete rendering. If true,
|
||||
@@ -436,7 +439,9 @@ def make_request(
|
||||
)
|
||||
|
||||
if content:
|
||||
if content_is_form:
|
||||
if content_type is not None:
|
||||
req.requestHeaders.addRawHeader(b"Content-Type", content_type)
|
||||
elif content_is_form:
|
||||
req.requestHeaders.addRawHeader(
|
||||
b"Content-Type", b"application/x-www-form-urlencoded"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user