1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Adding polyfill to Headers.getAll to make it work both with the current and past spec. (#723)

This commit is contained in:
Dan Zajdband 2017-01-10 16:42:10 -03:00 committed by Guillermo Rauch
parent c19b82dfe2
commit f8986cfd92

View file

@ -16,7 +16,9 @@ self.addEventListener('activate', (e) => {
})
self.addEventListener('fetch', (e) => {
for (const a of e.request.headers.getAll('accept')) {
const h = e.request.headers
const accept = h.getAll ? h.getAll('accept') : h.get('accept').split(',')
for (const a of accept) {
// bypass Server Sent Events
if (a === 'text/event-stream') return
}