mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-04-01 07:28:24 +01:00
fix e2e tests
This commit is contained in:
parent
b67078a310
commit
4b01648168
@ -1,8 +1,12 @@
|
|||||||
export function validateEndpoint(endpointToValidate: string | undefined, allowedEndpoints: string[]): boolean {
|
export function validateEndpoint(endpointToValidate: string | undefined, allowedEndpoints: string[]): boolean {
|
||||||
if (!endpointToValidate) {
|
try {
|
||||||
return true;
|
return validateEndpointInternal(endpointToValidate, allowedEndpoints);
|
||||||
|
} catch {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function validateEndpointInternal(endpointToValidate: string | undefined, allowedEndpoints: string[]): boolean {
|
||||||
const originToValidate: string = new URL(endpointToValidate).origin;
|
const originToValidate: string = new URL(endpointToValidate).origin;
|
||||||
const allowedOrigins: string[] = allowedEndpoints.map((allowedEndpoint) => new URL(allowedEndpoint).origin) || [];
|
const allowedOrigins: string[] = allowedEndpoints.map((allowedEndpoint) => new URL(allowedEndpoint).origin) || [];
|
||||||
const valid = allowedOrigins.indexOf(originToValidate) >= 0;
|
const valid = allowedOrigins.indexOf(originToValidate) >= 0;
|
||||||
@ -33,7 +37,7 @@ export const allowedMongoProxyEndpoints: ReadonlyArray<string> = [
|
|||||||
"https://localhost:12901",
|
"https://localhost:12901",
|
||||||
];
|
];
|
||||||
|
|
||||||
export const allowedEmulatorEndpoints: ReadonlyArray<string> = [];
|
export const allowedEmulatorEndpoints: ReadonlyArray<string> = ["https://localhost:8081"];
|
||||||
|
|
||||||
export const allowedGraphEndpoints: ReadonlyArray<string> = [];
|
export const allowedGraphEndpoints: ReadonlyArray<string> = [];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user