Adjust cache header

pull/282/head
Amio 2019-05-26 21:34:39 +08:00
rodzic 83859a1ccb
commit 7c41eba91e
2 zmienionych plików z 3 dodań i 2 usunięć

Wyświetl plik

@ -1,6 +1,6 @@
import cheerio from 'cheerio'
import got from '../libs/got'
import { millify, stars, version, versionColor } from '../libs/utils'
import { millify, version, versionColor } from '../libs/utils'
import {
badgenServe,
BadgenServeMeta as Meta,

Wyświetl plik

@ -31,7 +31,8 @@ export default function (req, res, options: ServeBadgeOptions) {
})
const staleControl = `stale-while-revalidate=604800, stale-if-error=604800`
res.setHeader('Cache-Control', `public, max-age=10, s-maxage=${sMaxAge}, ${staleControl}`)
const cacheControl = `public, max-age=20, s-maxage=${sMaxAge}, ${staleControl}`
res.setHeader('Cache-Control', cacheControl)
res.setHeader('Content-Type', 'image/svg+xml;charset=utf-8')
res.statusCode = code
res.end(badge)