mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-10 07:28:50 +00:00
fix: verify response type (#4182)
Co-authored-by: sidwebworks <[email protected]>
This commit is contained in:
@@ -31,12 +31,16 @@ export const validateOnePassConnectionCredentials = async (config: TOnePassConne
|
|||||||
const { apiToken } = config.credentials;
|
const { apiToken } = config.credentials;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await request.get(`${instanceUrl}/v1/vaults`, {
|
const res = await request.get(`${instanceUrl}/v1/vaults`, {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${apiToken}`,
|
Authorization: `Bearer ${apiToken}`,
|
||||||
Accept: "application/json"
|
Accept: "application/json"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!Array.isArray(res.data)) {
|
||||||
|
throw new AxiosError("Invalid response from 1Password API");
|
||||||
|
}
|
||||||
} catch (error: unknown) {
|
} catch (error: unknown) {
|
||||||
if (error instanceof AxiosError) {
|
if (error instanceof AxiosError) {
|
||||||
throw new BadRequestError({
|
throw new BadRequestError({
|
||||||
|
|||||||
Reference in New Issue
Block a user