Skip to content

Commit

Permalink
Fix: add response type with arraybuffer readBinary call (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
bookmountain authored Sep 5, 2023
1 parent 33cb175 commit 8608773
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ describe("StorageProvider", () => {

it("should handle readBinary", async () => {
await provider.readBinary(mockFilename);
expect(RequestHelper.getWithAutoRetry).toBeCalledWith(`${serverUrl}/files/${mockFilename}`);
expect(RequestHelper.getWithAutoRetry).toBeCalledWith(`${serverUrl}/files/${mockFilename}`, {
responseType: "arraybuffer",
});
});

it("should handle writeText", async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class StorageProvider implements IStorageProvider {
public async readBinary(filename: string, ignoreNotFound?: boolean): Promise<Buffer | undefined> {
try {
const api = `${serverUrl}/files/${filename}`;
const result = await getWithAutoRetry(api);
const result = await getWithAutoRetry(api, { responseType: "arraybuffer" });

return result.data;
} catch (exception) {
Expand Down

0 comments on commit 8608773

Please sign in to comment.