mirror of
https://github.com/DIYgod/RSSHub.git
synced 2025-12-09 23:00:48 +08:00
feat(core): add public in cache-control header
This commit is contained in:
@@ -6,7 +6,7 @@ const headers = {
|
|||||||
'Access-Control-Allow-Headers': 'Content-Type, Content-Length, Authorization, Accept, X-Requested-With',
|
'Access-Control-Allow-Headers': 'Content-Type, Content-Length, Authorization, Accept, X-Requested-With',
|
||||||
'Access-Control-Allow-Methods': 'GET',
|
'Access-Control-Allow-Methods': 'GET',
|
||||||
'Content-Type': 'application/xml; charset=utf-8',
|
'Content-Type': 'application/xml; charset=utf-8',
|
||||||
'Cache-Control': `max-age=${config.cacheExpire}`,
|
'Cache-Control': `public, max-age=${config.cacheExpire}`,
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = async (ctx, next) => {
|
module.exports = async (ctx, next) => {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ describe('header', () => {
|
|||||||
expect(response.headers['access-control-allow-headers']).toBe('Content-Type, Content-Length, Authorization, Accept, X-Requested-With');
|
expect(response.headers['access-control-allow-headers']).toBe('Content-Type, Content-Length, Authorization, Accept, X-Requested-With');
|
||||||
expect(response.headers['access-control-allow-methods']).toBe('GET');
|
expect(response.headers['access-control-allow-methods']).toBe('GET');
|
||||||
expect(response.headers['content-type']).toBe('application/xml; charset=utf-8');
|
expect(response.headers['content-type']).toBe('application/xml; charset=utf-8');
|
||||||
expect(response.headers['cache-control']).toBe(`max-age=${config.cacheExpire}`);
|
expect(response.headers['cache-control']).toBe(`public, max-age=${config.cacheExpire}`);
|
||||||
expect(response.headers['last-modified']).toBe(response.text.match(/<lastBuildDate>(.*)<\/lastBuildDate>/)[1]);
|
expect(response.headers['last-modified']).toBe(response.text.match(/<lastBuildDate>(.*)<\/lastBuildDate>/)[1]);
|
||||||
// expect(response.headers.etag).toBe('"b37-MORyrF0tJ8BFw0xLLZL/zBYAFPY"');
|
// expect(response.headers.etag).toBe('"b37-MORyrF0tJ8BFw0xLLZL/zBYAFPY"');
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user