@browserless/function 13.1.5 → 13.1.6
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 +3 -3
- package/src/index.js +6 -1
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@browserless/function",
|
|
3
3
|
"description": "Execute arbitrary JavaScript code in a secure browser sandbox with access to page DOM and network.",
|
|
4
4
|
"homepage": "https://browserless.js.org",
|
|
5
|
-
"version": "13.1.
|
|
5
|
+
"version": "13.1.6",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"author": {
|
|
8
8
|
"email": "hello@microlink.io",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"require-one-of": "~1.0.24"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@browserless/test": "13.1.
|
|
42
|
+
"@browserless/test": "13.1.6",
|
|
43
43
|
"ava": "5",
|
|
44
44
|
"lodash": "latest"
|
|
45
45
|
},
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"timeout": "2m",
|
|
59
59
|
"workerThreads": false
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "6e72f371de1e8515b309b9a22e7632a564af27b0"
|
|
62
62
|
}
|
package/src/index.js
CHANGED
|
@@ -22,6 +22,8 @@ const getTargetId = async page => {
|
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
const isHttpResponse = response => response != null && typeof response.status === 'function'
|
|
26
|
+
|
|
25
27
|
const serializeResponse = response => ({
|
|
26
28
|
status: response.status(),
|
|
27
29
|
statusText: response.statusText(),
|
|
@@ -78,7 +80,7 @@ module.exports = ({ tmpdir } = {}) => {
|
|
|
78
80
|
device,
|
|
79
81
|
...opts,
|
|
80
82
|
...fnOpts,
|
|
81
|
-
...(response && { _response: serializeResponse(response) })
|
|
83
|
+
...(isHttpResponse(response) && { _response: serializeResponse(response) })
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
if (runFunctionOpts.code === code) {
|
|
@@ -134,3 +136,6 @@ module.exports = ({ tmpdir } = {}) => {
|
|
|
134
136
|
|
|
135
137
|
return createFunction
|
|
136
138
|
}
|
|
139
|
+
|
|
140
|
+
module.exports.isHttpResponse = isHttpResponse
|
|
141
|
+
module.exports.serializeResponse = serializeResponse
|