Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/providers/r2Provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,10 @@ function areConditionalHeadersPresent(

const { conditionalHeaders } = options;

// Only check for if-none-match and if-unmodified-since because the docs said
// Only check for if-unmodified-since because the docs said
// so, also what nginx does from my experiments
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412
return (
conditionalHeaders.ifNoneMatch !== undefined ||
conditionalHeaders.ifUnmodifiedSince !== undefined
);
return conditionalHeaders.ifUnmodifiedSince !== undefined;
}

function determineHttpStatusCode(
Expand All @@ -208,7 +205,7 @@ function determineHttpStatusCode(
return 412;
}

// We weren't given a body and preconditions succeeded.
// We weren't given a body
return 304;
}

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/file.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ describe('File Tests', () => {
'if-none-match': originalETag,
},
});
assert(res.status === 304 || res.status === 412);
assert(res.status === 304);
});

it('handles range header correctly', async () => {
Expand Down
Loading