Skip to content

Commit

Permalink
only apply fix to cors requests with credentials=include
Browse files Browse the repository at this point in the history
  • Loading branch information
luke committed Oct 31, 2017
1 parent fd4b48f commit 05f78a8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ function fetchAndCache (request, options) {
var clonedRequest = request.clone()
if (navigator.userAgent.indexOf('Crosswalk') !== -1) {
// HACK: fix for annoying bug in crosswalk where the credentials flag is incorrectly set
if (clonedRequest.credentials === 'include') {
clonedRequest.credentials = 'omit'
// console.log('crosswalk sw fetch credentials before fix', clonedRequest)
if (clonedRequest.mode === 'cors' && clonedRequest.credentials === 'include') {
clonedRequest = new Request(clonedRequest, {credentials: 'omit'})
// console.log('crosswalk sw fetch credentials after fix', clonedRequest)
// clonedRequest.credentials = 'omit'
}
}
return fetch(clonedRequest).then(function (response) {
Expand Down

0 comments on commit 05f78a8

Please sign in to comment.