Skip to content

Commit

Permalink
fix: only set 304 if etag matches
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Apr 27, 2020
1 parent e65ad3d commit e0c7354
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/node/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ export async function cachedRead(
if (ctx) {
ctx.etag = cached.etag
ctx.lastModified = new Date(cached.lastModified)
ctx.status = 304
if (ctx.get('If-None-Match') === ctx.tag) {
ctx.status = 304
}
// still set the content for *.vue requests
ctx.body = cached.content
}
Expand Down

0 comments on commit e0c7354

Please sign in to comment.