mirror of
https://git.mirrors.martin98.com/https://github.com/actions/toolkit
synced 2026-04-01 18:23:16 +08:00
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
This commit is contained in:
@@ -102,6 +102,20 @@ export class HttpClientResponse {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
async readBodyBuffer?(): Promise<Buffer> {
|
||||
return new Promise<Buffer>(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 {
|
||||
|
||||
Reference in New Issue
Block a user