Tests: Fix Karma tests on Node.js 20
commitd478a1c0226b7825a99718bf605ef9727ee4beca
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>
Thu, 8 Feb 2024 22:52:19 +0000 (8 23:52 +0100)
committerGitHub <noreply@github.com>
Thu, 8 Feb 2024 22:52:19 +0000 (8 23:52 +0100)
tree342ef57ec1cd649b7d7d9a8e0d88f98a01d20585
parentb507c8648f701acd1c48b3c38054ad38d76fd1ca
Tests: Fix Karma tests on Node.js 20

Node.js 20 started throwing errors when `writeHead` is called twice on
a response. This might have already been invalid before but it wasn't throwing
on Node.js 18.

Compute the headers object and call `writeHead` once to avoid the issue.

Closes gh-5397
test/middleware-mockserver.cjs