ibm-cloud-sdk-core
Advanced tools
Comparing version 2.17.3 to 2.17.4
@@ -57,3 +57,3 @@ <!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
| [removeSuffix(str, suffix)](./ibm-cloud-sdk-core.removesuffix.md) | Remove a given suffix if it exists. | | ||
| [streamToPromise(stream)](./ibm-cloud-sdk-core.streamtopromise.md) | Helper method that can be bound to a stream - it sets the output to utf-8, captures all of the results, and returns a promise that resolves to the final text Essentially a smaller version of concat-stream wrapped in a promise | | ||
| [streamToPromise(stream)](./ibm-cloud-sdk-core.streamtopromise.md) | Helper method that can be bound to a stream - it captures all of the results, and returns a promise that resolves to the final buffer or array of text chunks Essentially a smaller version of concat-stream wrapped in a promise | | ||
| [stripTrailingSlash(url)](./ibm-cloud-sdk-core.striptrailingslash.md) | | | ||
@@ -60,0 +60,0 @@ | [toLowerKeys(obj)](./ibm-cloud-sdk-core.tolowerkeys.md) | This function converts an object's keys to lower case. note: does not convert nested keys | |
@@ -7,3 +7,3 @@ <!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
Helper method that can be bound to a stream - it sets the output to utf-8, captures all of the results, and returns a promise that resolves to the final text Essentially a smaller version of concat-stream wrapped in a promise | ||
Helper method that can be bound to a stream - it captures all of the results, and returns a promise that resolves to the final buffer or array of text chunks Essentially a smaller version of concat-stream wrapped in a promise | ||
@@ -10,0 +10,0 @@ <b>Signature:</b> |
@@ -0,1 +1,8 @@ | ||
## [2.17.4](https://github.com/IBM/node-sdk-core/compare/v2.17.3...v2.17.4) (2021-12-16) | ||
### Bug Fixes | ||
* don't always convert bytes to text in streamToPromise ([#182](https://github.com/IBM/node-sdk-core/issues/182)) ([7fe261b](https://github.com/IBM/node-sdk-core/commit/7fe261b20f934cd3fde45acc69b9d4888836aa69)) | ||
## [2.17.3](https://github.com/IBM/node-sdk-core/compare/v2.17.2...v2.17.3) (2021-12-13) | ||
@@ -2,0 +9,0 @@ |
@@ -363,3 +363,4 @@ /* eslint-disable class-methods-use-this */ | ||
if (isStream(data)) { | ||
reqBuffer = Buffer.from(yield streamToPromise(data)); | ||
const streamData = yield streamToPromise(data); | ||
reqBuffer = Buffer.isBuffer(streamData) ? streamData : Buffer.from(streamData); | ||
} | ||
@@ -366,0 +367,0 @@ else if (data.toString && data.toString() !== '[object Object]' && !Array.isArray(data)) { |
@@ -19,3 +19,4 @@ /** | ||
/** | ||
* Helper method that can be bound to a stream - it sets the output to utf-8, captures all of the results, and returns a promise that resolves to the final text | ||
* Helper method that can be bound to a stream - it captures all of the results, and returns a promise that resolves to the final buffer | ||
* or array of text chunks | ||
* Essentially a smaller version of concat-stream wrapped in a promise | ||
@@ -22,0 +23,0 @@ * |
@@ -17,3 +17,4 @@ /** | ||
/** | ||
* Helper method that can be bound to a stream - it sets the output to utf-8, captures all of the results, and returns a promise that resolves to the final text | ||
* Helper method that can be bound to a stream - it captures all of the results, and returns a promise that resolves to the final buffer | ||
* or array of text chunks | ||
* Essentially a smaller version of concat-stream wrapped in a promise | ||
@@ -33,3 +34,3 @@ * | ||
.on('end', () => { | ||
resolve(Buffer.isBuffer(results[0]) ? Buffer.concat(results).toString() : results); | ||
resolve(Buffer.isBuffer(results[0]) ? Buffer.concat(results) : results); | ||
}) | ||
@@ -36,0 +37,0 @@ .on('error', reject); |
@@ -414,5 +414,5 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function () { | ||
var contentSetToGzip, reqBuffer, _a, _b, err_1; | ||
return __generator(this, function (_c) { | ||
switch (_c.label) { | ||
var contentSetToGzip, reqBuffer, streamData, err_1; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
@@ -423,10 +423,10 @@ contentSetToGzip = headers['Content-Encoding'] && headers['Content-Encoding'].toString().includes('gzip'); | ||
} | ||
_c.label = 1; | ||
_a.label = 1; | ||
case 1: | ||
_c.trys.push([1, 5, , 6]); | ||
_a.trys.push([1, 5, , 6]); | ||
if (!isstream_1.default(data)) return [3 /*break*/, 3]; | ||
_b = (_a = Buffer).from; | ||
return [4 /*yield*/, stream_to_promise_1.streamToPromise(data)]; | ||
case 2: | ||
reqBuffer = _b.apply(_a, [_c.sent()]); | ||
streamData = _a.sent(); | ||
reqBuffer = Buffer.isBuffer(streamData) ? streamData : Buffer.from(streamData); | ||
return [3 /*break*/, 4]; | ||
@@ -441,6 +441,6 @@ case 3: | ||
} | ||
_c.label = 4; | ||
_a.label = 4; | ||
case 4: return [3 /*break*/, 6]; | ||
case 5: | ||
err_1 = _c.sent(); | ||
err_1 = _a.sent(); | ||
logger_1.default.error('Error converting request body to a buffer - data will not be compressed.'); | ||
@@ -447,0 +447,0 @@ logger_1.default.debug(err_1); |
@@ -19,3 +19,4 @@ /** | ||
/** | ||
* Helper method that can be bound to a stream - it sets the output to utf-8, captures all of the results, and returns a promise that resolves to the final text | ||
* Helper method that can be bound to a stream - it captures all of the results, and returns a promise that resolves to the final buffer | ||
* or array of text chunks | ||
* Essentially a smaller version of concat-stream wrapped in a promise | ||
@@ -22,0 +23,0 @@ * |
@@ -19,3 +19,4 @@ "use strict"; | ||
/** | ||
* Helper method that can be bound to a stream - it sets the output to utf-8, captures all of the results, and returns a promise that resolves to the final text | ||
* Helper method that can be bound to a stream - it captures all of the results, and returns a promise that resolves to the final buffer | ||
* or array of text chunks | ||
* Essentially a smaller version of concat-stream wrapped in a promise | ||
@@ -35,3 +36,3 @@ * | ||
.on('end', function () { | ||
resolve(Buffer.isBuffer(results[0]) ? Buffer.concat(results).toString() : results); | ||
resolve(Buffer.isBuffer(results[0]) ? Buffer.concat(results) : results); | ||
}) | ||
@@ -38,0 +39,0 @@ .on('error', reject); |
{ | ||
"name": "ibm-cloud-sdk-core", | ||
"version": "2.17.3", | ||
"version": "2.17.4", | ||
"description": "Core functionality to support SDKs generated with IBM's OpenAPI SDK Generator.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
1406604
27836