@usebruno/js 0.33.0 → 0.34.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/bruno-request.js +8 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usebruno/js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"files": [
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"prepack": "npm run test"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@usebruno/common": "0.
|
|
19
|
+
"@usebruno/common": "0.8.0",
|
|
20
20
|
"@usebruno/crypto-js": "^3.1.9",
|
|
21
21
|
"@usebruno/query": "0.1.0",
|
|
22
22
|
"ajv": "^8.12.0",
|
package/src/bruno-request.js
CHANGED
|
@@ -169,6 +169,14 @@ class BrunoRequest {
|
|
|
169
169
|
this.timeout = timeout;
|
|
170
170
|
this.req.timeout = timeout;
|
|
171
171
|
}
|
|
172
|
+
|
|
173
|
+
onFail(callback) {
|
|
174
|
+
if (typeof callback === 'function') {
|
|
175
|
+
this.req.onFailHandler = callback;
|
|
176
|
+
} else if (callback) {
|
|
177
|
+
throw new Error(`${callback} is not a function`);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
172
180
|
|
|
173
181
|
__safeParseJSON(str) {
|
|
174
182
|
try {
|