Set Content-Type to application/json
in all manual endpoint trait implementations
This commit is contained in:
parent
4ced423612
commit
c27e66741a
@ -121,7 +121,7 @@ impl<'a> ruma_api::OutgoingRequest for Request<'a> {
|
||||
base_url: &str,
|
||||
access_token: Option<&str>,
|
||||
) -> Result<http::Request<Vec<u8>>, IntoHttpError> {
|
||||
use http::header::{HeaderValue, AUTHORIZATION};
|
||||
use http::header::{HeaderValue, AUTHORIZATION, CONTENT_TYPE};
|
||||
use percent_encoding::{utf8_percent_encode, NON_ALPHANUMERIC};
|
||||
|
||||
let http_request = http::Request::builder()
|
||||
@ -145,6 +145,7 @@ impl<'a> ruma_api::OutgoingRequest for Request<'a> {
|
||||
access_token.ok_or(IntoHttpError::NeedsAuthentication)?
|
||||
))?,
|
||||
)
|
||||
.header(CONTENT_TYPE, "application/json")
|
||||
.body(serde_json::to_vec(&self.content)?)?;
|
||||
|
||||
Ok(http_request)
|
||||
|
@ -114,7 +114,7 @@ impl<'a> ruma_api::OutgoingRequest for Request<'a> {
|
||||
base_url: &str,
|
||||
access_token: Option<&str>,
|
||||
) -> Result<http::Request<Vec<u8>>, IntoHttpError> {
|
||||
use http::header::{HeaderValue, AUTHORIZATION};
|
||||
use http::header::{HeaderValue, AUTHORIZATION, CONTENT_TYPE};
|
||||
use percent_encoding::{utf8_percent_encode, NON_ALPHANUMERIC};
|
||||
|
||||
let http_request = http::Request::builder()
|
||||
@ -137,6 +137,7 @@ impl<'a> ruma_api::OutgoingRequest for Request<'a> {
|
||||
access_token.ok_or(IntoHttpError::NeedsAuthentication)?
|
||||
))?,
|
||||
)
|
||||
.header(CONTENT_TYPE, "application/json")
|
||||
.body(serde_json::to_vec(&self.content)?)?;
|
||||
|
||||
Ok(http_request)
|
||||
|
@ -117,7 +117,7 @@ impl<'a> ruma_api::OutgoingRequest for Request<'a> {
|
||||
base_url: &str,
|
||||
access_token: Option<&str>,
|
||||
) -> Result<http::Request<Vec<u8>>, IntoHttpError> {
|
||||
use http::header::{HeaderValue, AUTHORIZATION};
|
||||
use http::header::{HeaderValue, AUTHORIZATION, CONTENT_TYPE};
|
||||
use percent_encoding::{utf8_percent_encode, NON_ALPHANUMERIC};
|
||||
|
||||
let http_request = http::Request::builder()
|
||||
@ -141,6 +141,7 @@ impl<'a> ruma_api::OutgoingRequest for Request<'a> {
|
||||
access_token.ok_or(IntoHttpError::NeedsAuthentication)?
|
||||
))?,
|
||||
)
|
||||
.header(CONTENT_TYPE, "application/json")
|
||||
.body(serde_json::to_vec(&self.content)?)?;
|
||||
|
||||
Ok(http_request)
|
||||
|
Loading…
x
Reference in New Issue
Block a user