@itentialopensource/adapter-utils 4.45.5 → 4.45.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/CHANGELOG.md CHANGED
@@ -1,4 +1,14 @@
1
1
 
2
+ ## 4.45.6 [05-19-2022]
3
+
4
+ * Change for token request with Auth header and data
5
+
6
+ Closes ADAPT-2056
7
+
8
+ See merge request itentialopensource/adapter-utils!232
9
+
10
+ ---
11
+
2
12
  ## 4.45.5 [05-14-2022]
3
13
 
4
14
  * handle missing token data in mockdata
@@ -1865,11 +1865,12 @@ function buildTokenRequest(reqPath, reqBody, callProperties, callback) {
1865
1865
  let bodyString = null;
1866
1866
 
1867
1867
  // if we have been passed a schema and the Authorization is in a header
1868
- if (tokenSchema && tokenSchema.headers && tokenSchema.headers.Authorization) {
1869
- // request the token
1870
- options.headers['Content-length'] = 0;
1871
- return getToken(reqPath, options, tokenSchema, '', callProperties, callback);
1872
- }
1868
+ // COMMENTED OUT AND HANDLED IN IF BELOW - take stuff out of body on line 1930
1869
+ // if (tokenSchema && tokenSchema.headers && tokenSchema.headers.Authorization) {
1870
+ // // request the token
1871
+ // options.headers['Content-length'] = 0;
1872
+ // return getToken(reqPath, options, tokenSchema, '', callProperties, callback);
1873
+ // }
1873
1874
  if (tokenSchema) {
1874
1875
  // if this is a get, need to put the username on the url
1875
1876
  if (options.path.indexOf('/{username}') >= 0) {
@@ -1926,6 +1927,12 @@ function buildTokenRequest(reqPath, reqBody, callProperties, callback) {
1926
1927
  }
1927
1928
  }
1928
1929
 
1930
+ if (tokenSchema.headers && tokenSchema.headers.Authorization) {
1931
+ // remove the username and password from the creds
1932
+ delete creds.username;
1933
+ delete creds.password;
1934
+ }
1935
+
1929
1936
  // map the data we received to an Entity - will get back the defaults
1930
1937
  const tokenEntity = transUtilInst.mapToOutboundEntity(creds, tokenSchema.requestSchema);
1931
1938
  bodyString = tokenEntity;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itentialopensource/adapter-utils",
3
- "version": "4.45.5",
3
+ "version": "4.45.6",
4
4
  "description": "Itential Adapter Utility Libraries",
5
5
  "scripts": {
6
6
  "postinstall": "node utils/setup.js",