From 2820b17d9daa81b3ce42c5cfefb3287eae7ed53a Mon Sep 17 00:00:00 2001 From: Chad Kimes <1936066+chkimes@users.noreply.github.com> Date: Fri, 4 Aug 2023 14:35:26 -0400 Subject: [PATCH 1/2] Add readBodyBuffer method to HttpClientResponse (#1475) * Add readBodyBuffer method to HttpClientResponse * Implement method in other package tests * Make method optional to satisfy the test process --- packages/http-client/package-lock.json | 4 ++-- packages/http-client/package.json | 2 +- packages/http-client/src/index.ts | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/packages/http-client/package-lock.json b/packages/http-client/package-lock.json index 333acf7f..503a680a 100644 --- a/packages/http-client/package-lock.json +++ b/packages/http-client/package-lock.json @@ -1,12 +1,12 @@ { "name": "@actions/http-client", - "version": "2.1.0", + "version": "2.1.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@actions/http-client", - "version": "2.1.0", + "version": "2.1.1", "license": "MIT", "dependencies": { "tunnel": "^0.0.6" diff --git a/packages/http-client/package.json b/packages/http-client/package.json index 61af4ee1..f0c747bd 100644 --- a/packages/http-client/package.json +++ b/packages/http-client/package.json @@ -1,6 +1,6 @@ { "name": "@actions/http-client", - "version": "2.1.0", + "version": "2.1.1", "description": "Actions Http Client", "keywords": [ "github", diff --git a/packages/http-client/src/index.ts b/packages/http-client/src/index.ts index ebea203d..a63e61b7 100644 --- a/packages/http-client/src/index.ts +++ b/packages/http-client/src/index.ts @@ -102,6 +102,20 @@ export class HttpClientResponse { }) }) } + + async readBodyBuffer?(): Promise { + return new Promise(async resolve => { + const chunks: Buffer[] = [] + + this.message.on('data', (chunk: Buffer) => { + chunks.push(chunk) + }) + + this.message.on('end', () => { + resolve(Buffer.concat(chunks)) + }) + }) + } } export function isHttps(requestUrl: string): boolean { From 19e00168782d1936225228c0fcf47b8a0e76f868 Mon Sep 17 00:00:00 2001 From: Chad Kimes <1936066+chkimes@users.noreply.github.com> Date: Fri, 4 Aug 2023 15:00:50 -0400 Subject: [PATCH 2/2] actions/http-client 2.1.1 release (#1483) --- packages/http-client/RELEASES.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/http-client/RELEASES.md b/packages/http-client/RELEASES.md index d3195080..5a942d4d 100644 --- a/packages/http-client/RELEASES.md +++ b/packages/http-client/RELEASES.md @@ -1,5 +1,8 @@ ## Releases +## 2.1.1 +- Add `HttpClientResponse.readBodyBuffer` method to read from a response stream and return a buffer [#1475](https://github.com/actions/toolkit/pull/1475) + ## 2.1.0 - Add support for `*` and subdomains in `no_proxy` [#1355](https://github.com/actions/toolkit/pull/1355) [#1223](https://github.com/actions/toolkit/pull/1223) - Bypass proxy for loopback IP adresses [#1360](https://github.com/actions/toolkit/pull/1360))