Skip to content

Lightpanda: the headless browser designed for AI and automation

add test for sync XHR headers check

Muki Kiboigo7d2dfef5c238
diff --git a/src/browser/tests/net/xhr.html b/src/browser/tests/net/xhr.html
index edb4333e5..ab223e09c 100644
--- a/src/browser/tests/net/xhr.html
+++ b/src/browser/tests/net/xhr.html
@@ -819,3 +819,17 @@ handler runs, abort() cancels the re-send and no load is delivered.
});
}
</script>
+
+<script id=xhr_sync_response_headers type=module>
+ {
+ // Sync XHR goes through HttpClient.submitSync; headers must still come
+ // back with copy_headers = true (which XHR always requests).
+ const req = new XMLHttpRequest();
+ req.open('GET', 'http://127.0.0.1:9582/xhr', false);
+ req.send();
+
+ testing.expectEqual(200, req.status);
+ testing.expectEqual('text/html; charset=utf-8', req.getResponseHeader('Content-Type'));
+ testing.expectEqual('content-length: 100\r\ncontent-type: text/html; charset=utf-8\r\n', req.getAllResponseHeaders());
+ }
+</script>