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 @@
if (gl.startup_calls && window.fetch) {
Object.keys(gl.startup_calls).forEach(apiCall => {
// 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.
gl.startup_calls[apiCall] = {
fetchCall: fetch(apiCall, { credentials: 'same-origin' })
gl.startup_calls[apiCall] = {
fetchCall: fetch(apiCall, {
// Emulate XHR for Rails AJAX request checks
headers: {
'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