Skip to content

Commit

Permalink
fix: only cache get requests (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Shaw authored Jul 24, 2023
1 parent f3cda76 commit e5b1fe2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ export function withCdnCache (handler) {
if ((request.headers.get('Cache-Control') || '').includes('no-cache')) {
return handler(request, env, ctx)
}
// Can only cache GET requestz
if (request.method !== 'GET') {
return handler(request, env, ctx)
}

let response
// Get from cache and return if existent
Expand Down

0 comments on commit e5b1fe2

Please sign in to comment.