mirror of
https://git.proxmox.com/git/proxmox
synced 2025-08-07 01:27:04 +00:00
client: fix content type parsing with included charset
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
1f351625a5
commit
d7f6fc4db5
@ -82,20 +82,20 @@ impl HttpApiResponse {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn assert_json_content_type(&self) -> Result<(), Error> {
|
fn assert_json_content_type(&self) -> Result<(), Error> {
|
||||||
match self.content_type.as_deref() {
|
match self
|
||||||
|
.content_type
|
||||||
|
.as_deref()
|
||||||
|
.and_then(|v| v.split(';').next())
|
||||||
|
{
|
||||||
Some("application/json") => Ok(()),
|
Some("application/json") => Ok(()),
|
||||||
Some(other) => {
|
Some(other) => Err(Error::BadApi(
|
||||||
Err(Error::BadApi(
|
format!("expected json body, got {other}",),
|
||||||
format!("expected json body, got {other}",),
|
None,
|
||||||
None,
|
)),
|
||||||
))
|
None => Err(Error::BadApi(
|
||||||
}
|
"expected json body, but no Content-Type was sent".to_string(),
|
||||||
None => {
|
None,
|
||||||
Err(Error::BadApi(
|
)),
|
||||||
"expected json body, but no Content-Type was sent".to_string(),
|
|
||||||
None,
|
|
||||||
))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user