Skip to content

Commit

Permalink
Remove unused function
Browse files Browse the repository at this point in the history
  • Loading branch information
hansott committed Nov 22, 2024
1 parent b518459 commit f60c33b
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions library/helpers/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,36 +59,6 @@ async function request({
});
}

async function handleResponse(response: IncomingMessage) {
return new Promise<{
body: string;
statusCode: number;
}>((resolve, reject) => {
let data = "";
let responseStream: Readable = response;

// Handle gzip-encoded response
if (response.headers && response.headers["content-encoding"] === "gzip") {
const gunzip = createGunzip();
responseStream = response.pipe(gunzip);
}

responseStream.on("data", (chunk) => {
data += chunk.toString();
});

responseStream.on("end", () => {
// We don't throw errors unless the request times out, is aborted or fails for low level reasons
// Error objects are annoying to work with
// That's why we use `resolve` instead of `reject`
resolve({
body: data,
statusCode: response.statusCode || 0,
});
});
});
}

export async function fetch({
url,
method = "GET",
Expand Down

0 comments on commit f60c33b

Please sign in to comment.