Skip to content

Crawlee—A web scraping and browser automation library for Node.js to build reliable crawlers. In JavaScript and TypeScript. Extract data for AI, LLMs, RAG, or GPTs. Download HTML, PDF, JPG, PNG, and other files from websites. Works with Puppeteer, Playwright, Cheerio, JSDOM, and raw HTTP. Both headful and headless mode. With proxy rotation.

fixed headers to have correct order.

Petr Pateka83f1bd1113c
diff --git a/test/utils_request.js b/test/utils_request.js
index a8cfa4cdc..ee4889e15 100644
--- a/test/utils_request.js
+++ b/test/utils_request.js
@@ -163,7 +163,7 @@ describe('Apify.utils_request', () => {
const response = await requestAsBrowser(options);
expect(response.statusCode).to.eql(200);
- expect(JSON.parse(response.body)['user-agent']).to.be.eql(options.headers['User-Agent']);
+ expect(JSON.parse(response.body)['User-Agent']).to.be.eql(options.headers['User-Agent']);
});
it('headers has same format as in firefox', async () => {
@@ -177,10 +177,10 @@ describe('Apify.utils_request', () => {
expect(response.statusCode).to.eql(200);
- expect(headersArray[0]).to.be.eql('User-Agent');
- expect(headersArray[1]).to.be.eql(FIREFOX_DESKTOP_USER_AGENT);
- expect(headersArray[2]).to.be.eql('Host');
- expect(headersArray[3]).to.be.eql(host);
+ expect(headersArray[0]).to.be.eql('Host');
+ expect(headersArray[1]).to.be.eql(host);
+ expect(headersArray[2]).to.be.eql('User-Agent');
+ expect(headersArray[3]).to.be.eql(FIREFOX_DESKTOP_USER_AGENT);
expect(headersArray[4]).to.be.eql('Accept');
expect(headersArray[5]).to.be.eql('text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8');
expect(headersArray[6]).to.be.eql('Accept-Language');