mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-20 14:11:07 +02:00
* intial changes, haven't tested client counts or done test coverage * client count rename getter to clairfy * fix has-permission api-paths * wip * wip * fix: explicitly refresh vault.cluster model to re-fetch activatedFeatures after actication * tests: fix # of assertions for verifying that activation was called * tests: tidy overview-test * add additional api permission path and move fetch back to application * add test coverage for the service * cleanup * remove test that checked for upsell without license or on community * small comment change * welp missed component getter * flaky test fix * flaky test * small nit changes from pr reviews * add defaults to sync mirage handler * Gate sync overview route for users without access (#27320) * routes: add redirect if user does not have access to sync * tests: verify redirect on sync overview page happens * tests: organize tests modules to ensure enterprise is explicitly set up * add type enterprise required now because we do a check for this first * fix oss test --------- Co-authored-by: Noelle Daley <noelledaley@users.noreply.github.com>
29 lines
889 B
JavaScript
29 lines
889 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
// passthrough request and modify response from server
|
|
// pass object as second arg of properties in response to override
|
|
// ex: server.get('sys/health', (schema, req) => modifyPassthroughResponse(req, { enterprise: true }));
|
|
export default function (req, props = {}) {
|
|
return new Promise((resolve) => {
|
|
const xhr = req.passthrough();
|
|
xhr.onreadystatechange = () => {
|
|
if (xhr.readyState === 4) {
|
|
if (xhr.status < 300) {
|
|
// XMLHttpRequest response prop only has a getter -- redefine as writable and set value
|
|
Object.defineProperty(xhr, 'response', {
|
|
writable: true,
|
|
value: JSON.stringify({
|
|
...JSON.parse(xhr.responseText),
|
|
...props,
|
|
}),
|
|
});
|
|
}
|
|
resolve();
|
|
}
|
|
};
|
|
});
|
|
}
|