ui: Use credentials for all HTTP API requests (#14343)

Adds withCredentials/credentials to all HTTP API requests.
This commit is contained in:
John Cowen 2022-09-01 18:15:06 +01:00 committed by GitHub
parent e36650c49c
commit c06cc60b90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 0 deletions

4
.changelog/14343.txt Normal file
View File

@ -0,0 +1,4 @@
```release-note:feature
ui: Use withCredentials for all HTTP API requests
```

View File

@ -210,6 +210,7 @@ export default class HttpService extends Service {
return this.settings.findBySlug('token').then(token => {
return fetch(`${path}`, {
...params,
credentials: 'include',
headers: {
'X-Consul-Token': typeof token.SecretID === 'undefined' ? '' : token.SecretID,
...params.headers,

View File

@ -27,6 +27,7 @@ export default function(parseHeaders, XHR) {
};
Object.entries(headers).forEach(([key, value]) => xhr.setRequestHeader(key, value));
options.beforeSend(xhr);
xhr.withCredentials = true;
xhr.send(options.body);
return xhr;
};