sstur / nbit

A zero-dependency, strongly-typed web framework for Bun, Node and Cloudflare workers
65 stars 4 forks source link

Cache control not set when maxAge is 0 #12

Closed usaccounts closed 1 year ago

usaccounts commented 1 year ago

In fileServing.ts:

if (maxAge) {
    headers['Cache-Control'] = `max-age=${maxAge}`;
}

will not set the header as 0 == false This should be:

if (maxAge == undefined) {
    headers['Cache-Control'] = `max-age=${maxAge}`;
}
sstur commented 1 year ago

Fixed in v0.13.2