Skip to content

Commit 0231775

Browse files
committedDec 11, 2024
refactor(cloudflare-kv-http): use new bulk/delete api for clear()
1 parent 6b7ff6a commit 0231775

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed
 

‎src/drivers/cloudflare-kv-http.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,12 @@ export default defineDriver<KVHTTPOptions>((opts) => {
206206
// Call bulk delete endpoint with each chunk
207207
await Promise.all(
208208
chunks.map((chunk) => {
209-
return kvFetch("/bulk", {
210-
method: "DELETE",
211-
body: { keys: chunk },
212-
});
209+
if (chunk.length > 0) {
210+
return kvFetch("/bulk/delete", {
211+
method: "POST",
212+
body: chunk,
213+
});
214+
}
213215
})
214216
);
215217
};

0 commit comments

Comments
 (0)
Please sign in to comment.