@browserless/goto 10.1.17 → 10.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/index.js +8 -3
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@browserless/goto",
|
|
3
3
|
"description": "Go to a page aborting unnecessary requests",
|
|
4
4
|
"homepage": "https://browserless.js.org/#/?id=gotopage-options",
|
|
5
|
-
"version": "10.
|
|
5
|
+
"version": "10.2.0",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"author": {
|
|
8
8
|
"email": "hello@microlink.io",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"timeout": "2m",
|
|
62
62
|
"workerThreads": false
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "788449b48f993c02c2521ff3b872e06c4c137c5c",
|
|
65
65
|
"scripts": {
|
|
66
66
|
"postinstall": "node scripts/postinstall",
|
|
67
67
|
"test": "ava"
|
package/src/index.js
CHANGED
|
@@ -11,6 +11,8 @@ const isUrl = require('is-url-http')
|
|
|
11
11
|
const path = require('path')
|
|
12
12
|
const fs = require('fs')
|
|
13
13
|
|
|
14
|
+
const { DEFAULT_INTERCEPT_RESOLUTION_PRIORITY } = require('puppeteer')
|
|
15
|
+
|
|
14
16
|
const debug = require('debug-logfmt')('browserless:goto')
|
|
15
17
|
debug.continue = require('debug-logfmt')('browserless:goto:continue')
|
|
16
18
|
debug.abort = require('debug-logfmt')('browserless:goto:abort')
|
|
@@ -253,10 +255,13 @@ module.exports = ({ defaultDevice = 'Macbook Pro 13', timeout: globalTimeout, ..
|
|
|
253
255
|
|
|
254
256
|
if (!abortTypes.includes(resourceType)) {
|
|
255
257
|
debug.continue({ url, resourceType })
|
|
256
|
-
return req.continue(
|
|
258
|
+
return req.continue(
|
|
259
|
+
req.continueRequestOverrides(),
|
|
260
|
+
DEFAULT_INTERCEPT_RESOLUTION_PRIORITY
|
|
261
|
+
)
|
|
257
262
|
}
|
|
258
263
|
debug.abort({ url, resourceType })
|
|
259
|
-
return req.abort('blockedbyclient',
|
|
264
|
+
return req.abort('blockedbyclient', DEFAULT_INTERCEPT_RESOLUTION_PRIORITY)
|
|
260
265
|
})
|
|
261
266
|
})
|
|
262
267
|
}
|
|
@@ -281,7 +286,7 @@ module.exports = ({ defaultDevice = 'Macbook Pro 13', timeout: globalTimeout, ..
|
|
|
281
286
|
)
|
|
282
287
|
}
|
|
283
288
|
|
|
284
|
-
const device = getDevice({ headers, ...args })
|
|
289
|
+
const device = getDevice({ headers, ...args, device: args.device ?? defaultDevice })
|
|
285
290
|
|
|
286
291
|
if (device.userAgent && !headers['user-agent']) {
|
|
287
292
|
headers['user-agent'] = device.userAgent
|