fix: the method for correcting judgment headers (#1159)

Co-authored-by: loverustfs <hello@rustfs.com>
This commit is contained in:
GatewayJ
2025-12-16 19:30:50 +08:00
committed by GitHub
parent 52c2d15a4b
commit 0bca1fbd56

View File

@@ -96,12 +96,16 @@ where
}
// AssumeRole
if method == Method::POST && path == "/" {
if let Some(val) = headers.get(header::CONTENT_TYPE) {
if val.as_bytes() == b"application/x-www-form-urlencoded" {
return true;
}
}
if method == Method::POST
&& path == "/"
&& headers
.get(header::CONTENT_TYPE)
.and_then(|v| v.to_str().ok())
.map(|ct| ct.split(';').next().unwrap_or("").trim())
.map(|ct| ct == "application/x-www-form-urlencoded")
.unwrap_or(false)
{
return true;
}
path.starts_with(ADMIN_PREFIX) || path.starts_with(RPC_PREFIX) || is_console_path(path)