Compare commits

...

2 Commits

Author SHA1 Message Date
vinibuzzacaro 5dd98bcc14
Merge 9ea97a676a into 219b988300 2025-11-11 01:25:14 +00:00
Vinicius Buzzacaro 9ea97a676a Content type is now being compared ignoring case 2025-11-10 22:25:04 -03:00
1 changed files with 5 additions and 2 deletions

View File

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