XMLHttpRequest Send: fix Content-Type failures (#38993)

Replaced usage of `typed_insert` since it ended converting `UTF-8` to
lowercase.
Removed one of the test cases since it wasn't following spec since
[xhr/205](https://github.com/whatwg/xhr/pull/205).

Testing: Changes covered by wpt
Fixes: #20436

---------

Signed-off-by: Gae24 <96017547+Gae24@users.noreply.github.com>
This commit is contained in:
Gae24 2025-08-28 14:44:42 +02:00 committed by GitHub
parent cb64def7e6
commit 908c392219
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 7 additions and 32 deletions

View file

@ -739,7 +739,7 @@ impl XMLHttpRequestMethods<crate::DomTypeHolder> for XMLHttpRequest {
.collect();
let new_mime = format!(
"{}/{}; charset={}{}{}",
"{}/{};charset={}{}{}",
mime.type_,
mime.subtype,
encoding,
@ -750,9 +750,11 @@ impl XMLHttpRequestMethods<crate::DomTypeHolder> for XMLHttpRequest {
.collect::<Vec<String>>()
.join("; ")
);
request
.headers
.typed_insert(ContentType::from_str(&new_mime).unwrap())
request.headers.insert(
header::CONTENT_TYPE,
HeaderValue::from_str(&new_mime).unwrap(),
);
}
}
}