Fixing Firefox RSS handling

This commit is contained in:
Klemek
2019-06-26 18:43:41 +02:00
parent 528e4be1fe
commit ae4e2eb8d5
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -160,7 +160,7 @@ module.exports = (config) => {
});
lastRSS = feed.xml();
}
res.type('rss').send(lastRSS);
res.type(req.headers['user-agent'].match(/Mozilla/) ? 'xml' : 'rss').send(lastRSS);
} else {
showError(req.path, 404, res);
}
+1
View File
@@ -175,6 +175,7 @@ describe('Test RSS feed', () => {
test('200 empty rss', (done) => {
request(app).get('/rsstest').then((response) => {
expect(response.statusCode).toBe(200);
expect(response.type).toBe('application/rss+xml');
expect(response.text.length).toBeGreaterThan(0);
expect(response.text.split('<item>').length).toBe(1);
done();