Fixed XHR uploads
This commit is contained in:
parent
0856fc209a
commit
0a0cbf6467
@ -106,7 +106,14 @@ class MyServiceWorker {
|
||||
|
||||
// onRequest intercepts all browser requests
|
||||
onRequest(evt: FetchEvent) {
|
||||
return evt.respondWith(this.fromNetwork(evt.request))
|
||||
// Allow XHR upload requests via POST,
|
||||
// so that we can receive upload progress events.
|
||||
if(evt.request.method === "POST") {
|
||||
return
|
||||
}
|
||||
|
||||
// Fetch via network
|
||||
return evt.respondWith(fetch(evt.request))
|
||||
|
||||
// let request = evt.request as Request
|
||||
|
||||
@ -345,10 +352,6 @@ class MyServiceWorker {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
fromNetwork(request): Promise<Response> {
|
||||
return fetch(request)
|
||||
}
|
||||
}
|
||||
|
||||
// MyCache is the cache used by the service worker.
|
||||
|
Loading…
Reference in New Issue
Block a user