Skip to content

Commit

Permalink
chore(ts): Extract HttpRequestOptionsWithUrl, add to middleware (#924)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkcranny authored Nov 25, 2024
1 parent 66dc9da commit 9310d6e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/core/types/zapier.custom.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ export interface HttpRequestOptions {
middlewareData?: Record<string, any>;
}

type HttpRequestOptionsWithUrl = HttpRequestOptions & { url: string };

interface BaseHttpResponse {
status: number;
headers: Headers;
Expand Down Expand Up @@ -209,16 +211,14 @@ export interface ZObject {
url: string,
options: HttpRequestOptions & { raw: true }
): Promise<RawHttpResponse<T>>;
<T = any>(
options: HttpRequestOptions & { raw: true; url: string }
): Promise<RawHttpResponse<T>>;
<T = any>(options: HttpRequestOptionsWithUrl & { raw: true }): Promise<
RawHttpResponse<T>
>;

<T = any>(url: string, options?: HttpRequestOptions): Promise<
HttpResponse<T>
>;
<T = any>(options: HttpRequestOptions & { url: string }): Promise<
HttpResponse<T>
>;
<T = any>(options: HttpRequestOptionsWithUrl): Promise<HttpResponse<T>>;
};

console: Console;
Expand Down Expand Up @@ -296,10 +296,10 @@ export type PerformFunction<BI = Record<string, any>, R = any> = (
) => Promise<R>;

export type BeforeRequestMiddleware = (
request: HttpRequestOptions,
request: HttpRequestOptionsWithUrl,
z: ZObject,
bundle: Bundle
) => HttpRequestOptions | Promise<HttpRequestOptions>;
) => HttpRequestOptionsWithUrl | Promise<HttpRequestOptionsWithUrl>;

export type AfterResponseMiddleware = (
response: HttpResponse,
Expand Down

0 comments on commit 9310d6e

Please sign in to comment.