@itentialopensource/adapter-utils 4.48.9 → 4.48.10

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/CHANGELOG.md CHANGED
@@ -1,4 +1,14 @@
1
1
 
2
+ ## 4.48.10 [03-24-2023]
3
+
4
+ * Added option to remove username and password from auth body and option to remove response headers
5
+
6
+ Closes ADAPT-2628
7
+
8
+ See merge request itentialopensource/adapter-utils!250
9
+
10
+ ---
11
+
2
12
  ## 4.48.9 [03-23-2023]
3
13
 
4
14
  * Add logic to strip escapes from the request body
@@ -101,6 +101,7 @@ let healthcheck = false;
101
101
  const healthchecklock = 0;
102
102
  let encodeUri = true;
103
103
  let authQueryEncode = null;
104
+ let addCreds = true;
104
105
 
105
106
  // Other global variables
106
107
  let id = null;
@@ -2009,6 +2010,12 @@ async function buildTokenRequest(reqPath, reqBody, callProperties, callback) {
2009
2010
  }
2010
2011
  }
2011
2012
 
2013
+ if (actReqBody && !addCreds) {
2014
+ // remove the username and password from the creds
2015
+ delete creds.username;
2016
+ delete creds.password;
2017
+ }
2018
+
2012
2019
  if (tokenSchema.headers && tokenSchema.headers.Authorization) {
2013
2020
  // remove the username and password from the creds
2014
2021
  delete creds.username;
@@ -3837,6 +3844,10 @@ class ConnectorRest {
3837
3844
  if (typeof props.authentication.authQueryEncode === 'boolean') {
3838
3845
  authQueryEncode = props.authentication.authQueryEncode;
3839
3846
  }
3847
+
3848
+ if (typeof props.authentication.addCreds === 'boolean') {
3849
+ addCreds = props.authentication.addCreds;
3850
+ }
3840
3851
  }
3841
3852
 
3842
3853
  // set the stub mode (optional - default is false)
@@ -23,6 +23,7 @@ let returnRawGl = false;
23
23
  let encodePath = true;
24
24
  let encodeUri = true;
25
25
  let stripEscapes = false;
26
+ let returnResponseHeaders = true;
26
27
  // INTERNAL FUNCTIONS
27
28
  /*
28
29
  * INTERNAL FUNCTION: Get the best match for the mock data response
@@ -360,6 +361,10 @@ function handleRestRequest(request, entityId, entitySchema, callProperties, filt
360
361
  delete retObject.reqHdr;
361
362
  }
362
363
 
364
+ if (returnResponseHeaders === false && retObject.headers) {
365
+ delete retObject.headers;
366
+ }
367
+
363
368
  // if we want the raw response
364
369
  if (returnRawGl || (callProperties && callProperties.request && callProperties.request.return_raw)) {
365
370
  retObject.raw = resObj.response;
@@ -1042,6 +1047,10 @@ class RestHandler {
1042
1047
  this.globalRequest = properties.request.global_request;
1043
1048
  globalRequestGl = this.globalRequest;
1044
1049
  }
1050
+
1051
+ if (typeof properties.request.returnResponseHeaders === 'boolean') {
1052
+ returnResponseHeaders = properties.request.returnResponseHeaders;
1053
+ }
1045
1054
  }
1046
1055
 
1047
1056
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itentialopensource/adapter-utils",
3
- "version": "4.48.9",
3
+ "version": "4.48.10",
4
4
  "description": "Itential Adapter Utility Libraries",
5
5
  "scripts": {
6
6
  "postinstall": "node utils/setup.js",