Compare commits

..

1 Commits

Author SHA1 Message Date
vinibuzzacaro 2769d345c7
Merge 5037f9acd7 into 219b988300 2025-11-10 21:54:09 -03:00
1 changed files with 2 additions and 5 deletions

View File

@ -289,17 +289,14 @@ impl<T> UrlEncoded<T> {
/// Create a new future to decode a URL encoded request payload. /// Create a new future to decode a URL encoded request payload.
pub fn new(req: &HttpRequest, payload: &mut Payload) -> Self { pub fn new(req: &HttpRequest, payload: &mut Payload) -> Self {
// check content type // check content type
let encoding_error = req if req.content_type() != Some("application/x-www-form-urlencoded") {
.content_type()
.map(|ct| !ct.eq_ignore_ascii_case("application/x-www-form-urlencoded"))
.unwrap_or(true);
if encoding_error {
return Self::err(UrlencodedError::ContentType); return Self::err(UrlencodedError::ContentType);
} }
let encoding = match req.encoding() { let encoding = match req.encoding() {
Ok(enc) => enc, Ok(enc) => enc,
Err(_) => return Self::err(UrlencodedError::ContentType), Err(_) => return Self::err(UrlencodedError::ContentType),
}; };
let mut len = None; let mut len = None;
if let Some(l) = req.headers().get(&CONTENT_LENGTH) { if let Some(l) = req.headers().get(&CONTENT_LENGTH) {
if let Ok(s) = l.to_str() { if let Ok(s) = l.to_str() {