Updates
This commit is contained in:
@@ -10,7 +10,6 @@ import grabHostNames from "../../utils/grab-host-names";
|
||||
import serializeQuery from "../../utils/serialize-query";
|
||||
|
||||
type Param<T = { [k: string]: any }> = {
|
||||
key?: string;
|
||||
body?: T;
|
||||
query?: T;
|
||||
useDefault?: boolean;
|
||||
@@ -18,6 +17,7 @@ type Param<T = { [k: string]: any }> = {
|
||||
method?:
|
||||
| (typeof DataCrudRequestMethods)[number]
|
||||
| (typeof DataCrudRequestMethodsLowerCase)[number];
|
||||
apiKey?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -27,12 +27,12 @@ export default async function queryDSQLAPI<
|
||||
T = { [k: string]: any },
|
||||
P = { [k: string]: any }
|
||||
>({
|
||||
key,
|
||||
body,
|
||||
query,
|
||||
useDefault,
|
||||
path: passedPath,
|
||||
method,
|
||||
apiKey,
|
||||
}: Param<T>): Promise<APIResponseObject<P>> {
|
||||
const grabedHostNames = grabHostNames({ useDefault });
|
||||
const { host, port, scheme } = grabedHostNames;
|
||||
@@ -49,7 +49,7 @@ export default async function queryDSQLAPI<
|
||||
let headers: OutgoingHttpHeaders = {
|
||||
"Content-Type": "application/json",
|
||||
Authorization:
|
||||
key ||
|
||||
apiKey ||
|
||||
(!method || method == "GET" || method == "get"
|
||||
? process.env.DSQL_READ_ONLY_API_KEY
|
||||
: undefined) ||
|
||||
|
||||
Reference in New Issue
Block a user