Skip to content

Commit

Permalink
add bytes to response
Browse files Browse the repository at this point in the history
  • Loading branch information
bdemann committed Dec 12, 2024
1 parent c1ce43a commit e73366d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib/experimental/fetch/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ export class AzleFetchResponse {
return (this.body as unknown as Uint8Array | Buffer).buffer;
}

async bytes(): Promise<Uint8Array> {
this.bodyUsed = true;

if (this.body === null) {
return new Uint8Array(0);
}
return new Uint8Array(this.body as unknown as Buffer);
}

async json(): Promise<string> {
this.bodyUsed = true;

Expand Down

0 comments on commit e73366d

Please sign in to comment.