Update packages/playwright-core/src/server/fetch.ts

Signed-off-by: Max Schmitt <max@schmitt.mx>
This commit is contained in:
Max Schmitt 2024-05-21 09:14:45 +02:00 committed by GitHub
parent b8470e805b
commit 55136ff51e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -337,7 +337,7 @@ export abstract class APIRequestContext extends SdkObject {
// HTTP-redirect fetch step 4: If locationURL is null, then return response.
// Best-effort UTF-8 decoding, per spec it's US-ASCII only, but browsers are more lenient.
// Node.js parses it as Latin1, so we convert it to UTF-8.
// Node.js parses it as Latin1 via std::v8::String, so we convert it to UTF-8.
const locationHeaderValue = Buffer.from(response.headers.location ?? '', 'latin1').toString('utf8');
if (locationHeaderValue) {
let locationURL;