Skip to content

Commit f513b10

Browse files
committed
set encoding for json responses
1 parent 028147b commit f513b10

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

packages/build/src/homebrew/utils.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ export async function httpGet(
4747
): Promise<any | Buffer> {
4848
const response = await new Promise<string | Buffer[]>((resolve, reject) => {
4949
https.get(url, (stream) => {
50+
if (responseType === 'json') {
51+
stream.setEncoding('utf8');
52+
}
53+
5054
let data: string | Buffer[] = responseType === 'json' ? '' : [];
5155
stream.on('error', (err) => reject(err));
5256
stream.on('data', (chunk) => {

0 commit comments

Comments
 (0)