LibWeb: Assign the Content-Type fetch response header as appropriate

The condition here was inverted.
This commit is contained in:
Timothy Flynn 2024-04-27 10:34:58 -04:00 committed by Andreas Kling
commit 34b446ab34
Notes: sideshowbarker 2024-07-16 20:31:50 +09:00
3 changed files with 21 additions and 1 deletions

View file

@ -113,7 +113,7 @@ WebIDL::ExceptionOr<void> Response::initialize_response(ResponseInit const& init
m_response->set_body(body->body);
// 3. If bodys type is non-null and responses header list does not contain `Content-Type`, then append (`Content-Type`, bodys type) to responses header list.
if (body->type.has_value() && m_response->header_list()->contains("Content-Type"sv.bytes())) {
if (body->type.has_value() && !m_response->header_list()->contains("Content-Type"sv.bytes())) {
auto header = Infrastructure::Header {
.name = MUST(ByteBuffer::copy("Content-Type"sv.bytes())),
.value = MUST(ByteBuffer::copy(body->type->span())),