ui: Use credentials for all HTTP API requests (#14343)
Adds withCredentials/credentials to all HTTP API requests.
This commit is contained in:
parent
fd8b367dc0
commit
fc6b2ccb00
|
@ -0,0 +1,4 @@
|
||||||
|
```release-note:feature
|
||||||
|
ui: Use withCredentials for all HTTP API requests
|
||||||
|
```
|
||||||
|
|
|
@ -210,6 +210,7 @@ export default class HttpService extends Service {
|
||||||
return this.settings.findBySlug('token').then(token => {
|
return this.settings.findBySlug('token').then(token => {
|
||||||
return fetch(`${path}`, {
|
return fetch(`${path}`, {
|
||||||
...params,
|
...params,
|
||||||
|
credentials: 'include',
|
||||||
headers: {
|
headers: {
|
||||||
'X-Consul-Token': typeof token.SecretID === 'undefined' ? '' : token.SecretID,
|
'X-Consul-Token': typeof token.SecretID === 'undefined' ? '' : token.SecretID,
|
||||||
...params.headers,
|
...params.headers,
|
||||||
|
|
|
@ -27,6 +27,7 @@ export default function(parseHeaders, XHR) {
|
||||||
};
|
};
|
||||||
Object.entries(headers).forEach(([key, value]) => xhr.setRequestHeader(key, value));
|
Object.entries(headers).forEach(([key, value]) => xhr.setRequestHeader(key, value));
|
||||||
options.beforeSend(xhr);
|
options.beforeSend(xhr);
|
||||||
|
xhr.withCredentials = true;
|
||||||
xhr.send(options.body);
|
xhr.send(options.body);
|
||||||
return xhr;
|
return xhr;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue