fix: files support cloudfare workers

This commit is contained in:
MARCROCK22 2024-05-07 21:18:50 -04:00
parent 49c26c44d0
commit d1fb9a88f4
2 changed files with 8 additions and 4 deletions

View File

@ -38,7 +38,9 @@ export class AttachmentBuilder {
* Creates a new Attachment instance.
* @param data - The partial attachment data.
*/
constructor(public data: Partial<AttachmentData> = { name: `${randomBytes(8).toString('base64url')}.jpg` }) {}
constructor(
public data: Partial<AttachmentData> = { name: `${randomBytes?.(8)?.toString('base64url') || 'default'}.jpg` },
) {}
/**
* Sets the name of the attachment.

View File

@ -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,
}),
);
});
});