@usebruno/js 0.16.0 → 0.18.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usebruno/js",
3
- "version": "0.16.0",
3
+ "version": "0.18.0",
4
4
  "license": "MIT",
5
5
  "main": "src/index.js",
6
6
  "files": [
@@ -46,7 +46,6 @@ class BrunoRequest {
46
46
  getMethod() {
47
47
  return this.req.method;
48
48
  }
49
-
50
49
  getAuthMode() {
51
50
  if (this.req?.oauth2) {
52
51
  return 'oauth2';
@@ -58,6 +57,8 @@ class BrunoRequest {
58
57
  return 'awsv4';
59
58
  } else if (this.req?.digestConfig) {
60
59
  return 'digest';
60
+ } else if (this.headers?.['X-WSSE'] || this.req?.auth?.username) {
61
+ return 'wsse';
61
62
  } else {
62
63
  return 'none';
63
64
  }
@@ -27,6 +27,15 @@ class BrunoResponse {
27
27
  getResponseTime() {
28
28
  return this.res ? this.res.responseTime : null;
29
29
  }
30
+
31
+ setBody(data) {
32
+ if (!this.res) {
33
+ return;
34
+ }
35
+
36
+ this.body = data;
37
+ this.res.data = data;
38
+ }
30
39
  }
31
40
 
32
41
  module.exports = BrunoResponse;
@@ -105,6 +105,12 @@ const addBrunoRequestShimToContext = (vm, req) => {
105
105
  vm.setProp(reqObject, 'setTimeout', setTimeout);
106
106
  setTimeout.dispose();
107
107
 
108
+ let disableParsingResponseJson = vm.newFunction('disableParsingResponseJson', function () {
109
+ req.disableParsingResponseJson();
110
+ });
111
+ vm.setProp(reqObject, 'disableParsingResponseJson', disableParsingResponseJson);
112
+ disableParsingResponseJson.dispose();
113
+
108
114
  vm.setProp(vm.global, 'req', reqObject);
109
115
  reqObject.dispose();
110
116
  };
@@ -25,6 +25,8 @@ const marshallToVm = (value, vm) => {
25
25
  }
26
26
  return obj;
27
27
  }
28
+ } else if (typeof value === 'function') {
29
+ return vm.newString('[Function (anonymous)]');
28
30
  }
29
31
  };
30
32