Skip to content

Commit

Permalink
feat(storage)!: Throw an error for 403 HTTP responses (#212)
Browse files Browse the repository at this point in the history
  • Loading branch information
manzt authored Oct 1, 2024
1 parent a3c1def commit 361a7aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/smooth-scissors-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@zarrita/storage": patch
---

`FetchStore` throws an error for 403 (forbidden) responses. This is a **breaking** change because previously `404` and `403` responses were treated the same way. Now, only `404` responses signify a "missing" key from the store.
2 changes: 1 addition & 1 deletion packages/storage/src/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function resolve(root: string | URL, path: AbsolutePath): URL {
async function handle_response(
response: Response,
): Promise<Uint8Array | undefined> {
if (response.status === 404 || response.status === 403) {
if (response.status === 404) {
return undefined;
}
if (response.status === 200 || response.status === 206) {
Expand Down

0 comments on commit 361a7aa

Please sign in to comment.