Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/lib/apiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type RequestOptions = {
params?: Record<string, string | number>;
body?: any;
timeout?: number;
responseType?: AxiosRequestConfig["responseType"];
raise_error?: boolean; // default: true
};

Expand Down Expand Up @@ -163,12 +164,14 @@ class ApiClient {
headers,
params,
timeout,
responseType,
raise_error = true,
}: RequestOptions): Promise<ApiResponse<T>> {
const config: AxiosRequestConfig = {
headers,
params,
timeout,
responseType,
httpsAgent: this.axiosAgent,
};
return this.requestWrapper<T>(
Expand Down
5 changes: 4 additions & 1 deletion src/tools/automate-utils/fetch-screenshots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ async function convertUrlsToBase64(
): Promise<Array<{ url: string; base64: string }>> {
const screenshots = await Promise.all(
urls.map(async (url) => {
const response = await apiClient.get({ url });
const response = await apiClient.get({
url,
responseType: "arraybuffer"
});
// Axios returns response.data as a Buffer for binary data
const base64 = Buffer.from(response.data).toString("base64");

Expand Down