@f5devcentral/atg-shared-utilities
Advanced tools
Comparing version 0.8.0 to 0.9.0
@@ -6,5 +6,4 @@ # Changelog | ||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). | ||
## [0.8.0] - 2023-06-29 | ||
## [Unreleased] | ||
### Added | ||
- Added all methods from AS3 `arrayUtil.js` | ||
@@ -17,11 +16,14 @@ ### Fixed | ||
## [0.9.0] - 2023-07-11 | ||
### Added | ||
- Added `returnResponseObj` option to `requestUtils.send` | ||
## [0.8.0] - 2023-06-29 | ||
### Added | ||
- Added all methods from AS3 `arrayUtil.js` | ||
## [0.7.0] - 2023-06-02 | ||
### Added | ||
- Added `ipUtil.isIPinRange`, and `ipUtil.ipToNumberString` methods. | ||
### Fixed | ||
### Changed | ||
### Removed | ||
## [0.6.0] - 2023-04-18 | ||
@@ -55,91 +57,37 @@ ### Changed | ||
## [0.5.2] 2022-12-20 | ||
### Added | ||
### Fixed | ||
### Changed | ||
- Handle special F5 addresses (any, route domain, etc) in ipUtils.splitAddress | ||
### Removed | ||
## [0.5.1] 2022-12-08 | ||
### Added | ||
### Fixed | ||
- Fix path to tmsh for older BIG-IP versions | ||
### Changed | ||
### Removed | ||
## [0.5.0] 2022-12-08 | ||
### Added | ||
### Fixed | ||
- Get primary admin user from system for http requests to port 8100 | ||
### Changed | ||
### Removed | ||
## [0.4.11] 2022-11-22 | ||
### Added | ||
### Fixed | ||
### Changed | ||
- Update packages | ||
### Removed | ||
## [0.4.10] 2022-10-06 | ||
### Added | ||
### Fixed | ||
- Handle wildcard addresses with route domains in minimizeIP | ||
### Changed | ||
### Removed | ||
## [0.4.9] 2022-10-06 | ||
### Added | ||
### Fixed | ||
- AUTOTOOL-3505: handle wildcard addresses in minimizeIP | ||
### Changed | ||
### Removed | ||
## [0.4.8] | ||
### Added | ||
### Fixed | ||
### Changed | ||
- Fix use of 'this' in secureVault | ||
### Removed | ||
## [0.4.7] 2022-09-29 | ||
### Added | ||
### Fixed | ||
### Changed | ||
- Update packages | ||
### Removed | ||
## [0.4.6] 2022-07-27 | ||
### Added | ||
### Fixed | ||
### Changed | ||
- Update packages | ||
### Removed | ||
## [0.4.5] - 2022-05-03 | ||
@@ -146,0 +94,0 @@ ### Changed |
{ | ||
"name": "@f5devcentral/atg-shared-utilities", | ||
"version": "0.8.0", | ||
"version": "0.9.0", | ||
"scripts": { | ||
@@ -5,0 +5,0 @@ "lint": "eslint .", |
@@ -101,3 +101,3 @@ # atg-shared-utilities | ||
### send(options, body) | ||
### send(requestOptions, body, options) | ||
@@ -104,0 +104,0 @@ Send an http/https request using the options and body. This is a wrapper around [node's http/https](https://nodejs.org/api/https.html#https) request functionality. |
@@ -33,14 +33,18 @@ /** | ||
* @private | ||
* @param {object} options - A JSON object with the following params. These are passed on to node's http/https | ||
* request method. See https://nodejs.org/api/https.html#httpsrequestoptions-callback | ||
* for details. | ||
* @param {object} options.headers - Holds various header options (e.g. 'Content-Length') | ||
* @param {string} options.protocol - 'http:' or 'https:' | ||
* @param {number} options.port | ||
* @param {string} options.auth - 'user:' | ||
* @param {object} requestOptions - A JSON object with the following params. These are passed on to node's | ||
* http/https request method. See | ||
* https://nodejs.org/api/https.html#httpsrequestoptions-callback for details. | ||
* @param {object} requestOptions.headers - Holds various header options (e.g. 'Content-Length') | ||
* @param {string} requestOptions.protocol - 'http:' or 'https:' | ||
* @param {number} requestOptions.port | ||
* @param {string} requestOptions.auth - 'user:' | ||
* @param {object} body | ||
* @returns {Promise} Promise object that resolves with the response body | ||
* @param {object} [options] - Addtional options to modify how the function behaves | ||
* @param {boolean} [options.returnResponseObj] - If true, returns the response object instead of just the body | ||
* @returns {Promise} Promise object that resolves with either the response body or the response object depending on | ||
* the options that are provided | ||
*/ | ||
static send(options, body) { | ||
const reqOpts = JSON.parse(JSON.stringify(options)); | ||
static send(requestOptions, body, options) { | ||
const reqOpts = JSON.parse(JSON.stringify(requestOptions)); | ||
const opts = options || {}; | ||
let protocol = https; | ||
@@ -91,3 +95,3 @@ let jsonBody; | ||
if (buffer.length === 0) { | ||
resolve(''); | ||
resolve(buildResponse('', response, opts)); | ||
return; | ||
@@ -99,3 +103,3 @@ } | ||
} | ||
resolve(''); | ||
resolve(buildResponse('', response, opts)); | ||
return; | ||
@@ -130,3 +134,3 @@ } | ||
} | ||
resolve(data); | ||
resolve(buildResponse(data, response, opts)); | ||
}); | ||
@@ -171,2 +175,13 @@ }); | ||
function buildResponse(body, response, options) { | ||
if (options.returnResponseObj) { | ||
return { | ||
body, | ||
statusCode: response.statusCode, | ||
headers: response.headers | ||
}; | ||
} | ||
return body; | ||
} | ||
module.exports = Request; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
79236
1521