MobileChromeApps / cordova-plugin-service-worker

163 stars 37 forks source link

Fetch response contains wrong headers #25

Open makryl opened 7 years ago

makryl commented 7 years ago

Hello. Thank you for great plugin! It looks like response.headers contains request headers instead of response headers. Simple code to see that request and response headers are same:

self.addEventListener('fetch', function(event) {
    event.respondWith(
        fetch(event.request).then(function(response) {
            console.log('request headers:');
            console.log(JSON.stringify(event.request.headers));
            console.log('response headers:');
            console.log(JSON.stringify(response.headers));
        })
    );
});