Skip to content
This repository has been archived by the owner on Feb 21, 2025. It is now read-only.

Commit

Permalink
Update type-rest-client to 1.8.9
Browse files Browse the repository at this point in the history
  • Loading branch information
bigdaz committed Feb 21, 2023
1 parent 48ced99 commit 9c75b4d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
9 changes: 6 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4579,17 +4579,18 @@ class HttpClientResponse {
}
readBody() {
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
let buffer = Buffer.alloc(0);
const chunks = [];
const encodingCharset = util.obtainContentCharset(this);
// Extract Encoding from header: 'content-encoding'
// Match `gzip`, `gzip, deflate` variations of GZIP encoding
const contentEncoding = this.message.headers['content-encoding'] || '';
const isGzippedEncoded = new RegExp('(gzip$)|(gzip, *deflate)').test(contentEncoding);
this.message.on('data', function (data) {
const chunk = (typeof data === 'string') ? Buffer.from(data, encodingCharset) : data;
buffer = Buffer.concat([buffer, chunk]);
chunks.push(chunk);
}).on('end', function () {
return __awaiter(this, void 0, void 0, function* () {
const buffer = Buffer.concat(chunks);
if (isGzippedEncoded) { // Process GZipped Response Body HERE
const gunzippedBody = yield util.decompressGzippedContent(buffer, encodingCharset);
resolve(gunzippedBody);
Expand Down Expand Up @@ -5120,7 +5121,9 @@ function decompressGzippedContent(buffer, charset) {
if (error) {
reject(error);
}
resolve(buffer.toString(charset || 'utf-8'));
else {
resolve(buffer.toString(charset || 'utf-8'));
}
});
}));
});
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"license": "MIT",
"dependencies": {
"@actions/core": "1.10.0",
"typed-rest-client": "1.8.4",
"typed-rest-client": "1.8.9",
"unhomoglyph": "1.0.6"
},
"devDependencies": {
Expand Down

0 comments on commit 9c75b4d

Please sign in to comment.