feat(core): switch to native fetch API for all HTTP requests
This commit is contained in:
@@ -114,14 +114,19 @@ export class BunqExport {
|
||||
// For PDF statements, use the /content endpoint directly
|
||||
const downloadUrl = `${this.bunqAccount.apiContext.getBaseUrl()}/v1/user/${this.bunqAccount.userId}/monetary-account/${this.monetaryAccount.id}/customer-statement/${this.id}/content`;
|
||||
|
||||
const response = await plugins.smartrequest.request(downloadUrl, {
|
||||
const response = await fetch(downloadUrl, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'X-Bunq-Client-Authentication': this.bunqAccount.apiContext.getSession().getContext().sessionToken
|
||||
}
|
||||
});
|
||||
|
||||
return Buffer.from(response.body);
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to download export: HTTP ${response.status}`);
|
||||
}
|
||||
|
||||
const arrayBuffer = await response.arrayBuffer();
|
||||
return Buffer.from(arrayBuffer);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user