Commit e1e68d05 authored by Enrique Alcántara's avatar Enrique Alcántara

Merge branch 'fix-http-caching-for-startup-js-requests' into 'master'

Set X-Requested-With for startup JS requests

See merge request gitlab-org/gitlab!72360
parents 77baeec6 5b10ead1
...@@ -8,11 +8,17 @@ ...@@ -8,11 +8,17 @@
if (gl.startup_calls && window.fetch) { if (gl.startup_calls && window.fetch) {
Object.keys(gl.startup_calls).forEach(apiCall => { Object.keys(gl.startup_calls).forEach(apiCall => {
// fetch won’t send cookies in older browsers, unless you set the credentials init option. gl.startup_calls[apiCall] = {
// We set to `same-origin` which is default value in modern browsers. fetchCall: fetch(apiCall, {
// See https://github.com/whatwg/fetch/pull/585 for more information. // Emulate XHR for Rails AJAX request checks
gl.startup_calls[apiCall] = { headers: {
fetchCall: fetch(apiCall, { credentials: 'same-origin' }) 'X-Requested-With': 'XMLHttpRequest'
},
// fetch won’t send cookies in older browsers, unless you set the credentials init option.
// We set to `same-origin` which is default value in modern browsers.
// See https://github.com/whatwg/fetch/pull/585 for more information.
credentials: 'same-origin'
})
}; };
}); });
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment