Updates
This commit is contained in:
@@ -8,6 +8,7 @@ import {
|
||||
} from "../../types";
|
||||
import grabHostNames from "../../utils/grab-host-names";
|
||||
import serializeQuery from "../../utils/serialize-query";
|
||||
import { RequestOptions } from "https";
|
||||
|
||||
type Param<T = { [k: string]: any }> = {
|
||||
body?: T;
|
||||
@@ -68,14 +69,16 @@ export default async function queryDSQLAPI<
|
||||
finalPath += `${queryString}`;
|
||||
}
|
||||
|
||||
const requestOptions: RequestOptions = {
|
||||
method: method || "GET",
|
||||
headers,
|
||||
port,
|
||||
hostname: host,
|
||||
path: finalPath,
|
||||
};
|
||||
|
||||
const httpsRequest = scheme.request(
|
||||
{
|
||||
method: method || "GET",
|
||||
headers,
|
||||
port,
|
||||
hostname: host,
|
||||
path: finalPath,
|
||||
},
|
||||
requestOptions,
|
||||
|
||||
/**
|
||||
* Callback Function
|
||||
@@ -96,8 +99,10 @@ export default async function queryDSQLAPI<
|
||||
resolve({
|
||||
success: false,
|
||||
payload: undefined,
|
||||
msg: error.message,
|
||||
});
|
||||
msg: `An error occurred while parsing the response`,
|
||||
error: error.message,
|
||||
errorData: requestOptions,
|
||||
} as APIResponseObject);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -105,8 +110,10 @@ export default async function queryDSQLAPI<
|
||||
resolve({
|
||||
success: false,
|
||||
payload: undefined,
|
||||
msg: err.message,
|
||||
});
|
||||
msg: `An error occurred on the response`,
|
||||
error: err.message,
|
||||
errorData: requestOptions,
|
||||
} as APIResponseObject);
|
||||
});
|
||||
}
|
||||
);
|
||||
@@ -115,8 +122,10 @@ export default async function queryDSQLAPI<
|
||||
resolve({
|
||||
success: false,
|
||||
payload: undefined,
|
||||
msg: err.message,
|
||||
});
|
||||
msg: `An error occurred while making the request`,
|
||||
error: err.message,
|
||||
errorData: requestOptions,
|
||||
} as APIResponseObject);
|
||||
});
|
||||
|
||||
if (reqPayload) {
|
||||
@@ -130,7 +139,8 @@ export default async function queryDSQLAPI<
|
||||
return {
|
||||
success: false,
|
||||
payload: undefined,
|
||||
msg: error.message,
|
||||
msg: `Request Failed`,
|
||||
error: error.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1608,6 +1608,7 @@ export type APIResponseObject<T extends any = any> = {
|
||||
errors?: DSQLErrorObject[];
|
||||
debug?: any;
|
||||
batchPayload?: any[][] | null;
|
||||
errorData?: any;
|
||||
};
|
||||
|
||||
export const UserTypes = ["su", "admin"] as const;
|
||||
|
||||
Reference in New Issue
Block a user