diff --git a/src/builders/Attachment.ts b/src/builders/Attachment.ts index 9de9e80..6bd252e 100644 --- a/src/builders/Attachment.ts +++ b/src/builders/Attachment.ts @@ -38,7 +38,9 @@ export class AttachmentBuilder { * Creates a new Attachment instance. * @param data - The partial attachment data. */ - constructor(public data: Partial = { name: `${randomBytes(8).toString('base64url')}.jpg` }) {} + constructor( + public data: Partial = { name: `${randomBytes?.(8)?.toString('base64url') || 'default'}.jpg` }, + ) {} /** * Sets the name of the attachment. diff --git a/src/client/httpclient.ts b/src/client/httpclient.ts index d565995..8e0c8ce 100644 --- a/src/client/httpclient.ts +++ b/src/client/httpclient.ts @@ -195,9 +195,11 @@ export class HttpClient extends BaseClient { } r( - Response.json(response, { - headers, - }), + response instanceof FormData + ? new Response(response, { headers }) + : Response.json(response, { + headers, + }), ); }); });