Skip to content

Commit

Permalink
fix request baseURL
Browse files Browse the repository at this point in the history
  • Loading branch information
plugged committed Jan 15, 2025
1 parent ea0deb6 commit 5af4221
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions factory/createClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export type CreateClientOptions = {
key?: string;
secret?: string;
accessToken?: string;
baseURL?: string;
baseURL?: (typeof baseURLs)[BaseURLKey];
paper?: boolean;
tokenBucket?: TokenBucketOptions;
};
Expand All @@ -54,7 +54,7 @@ export const createClient = (options: CreateClientOptions) => {
throw new Error("Missing credentials (need accessToken or key/secret)");
}

const baseURL = options.baseURL || (paper ? baseURLs.paper : baseURLs.live);
const defaultBaseURL = options.baseURL || (paper ? baseURLs.paper : baseURLs.live);

// Create a token bucket for rate limiting
const bucket = createTokenBucket(options.tokenBucket);
Expand All @@ -65,6 +65,7 @@ export const createClient = (options: CreateClientOptions) => {
path,
params,
data,
baseURL = defaultBaseURL
}: RequestOptions<T>): Promise<T> => {
await new Promise((resolve) => {
// Poll the token bucket every second
Expand Down

0 comments on commit 5af4221

Please sign in to comment.