From 329504af14dedfb924b918c27acb25c695db1922 Mon Sep 17 00:00:00 2001 From: Thomas Cranny Date: Mon, 25 Nov 2024 16:39:54 +1000 Subject: [PATCH] Extract HttpRequestOptionsWithUrl, add to middleware --- packages/core/types/zapier.custom.d.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/core/types/zapier.custom.d.ts b/packages/core/types/zapier.custom.d.ts index 1bb92230b..0d3e81837 100644 --- a/packages/core/types/zapier.custom.d.ts +++ b/packages/core/types/zapier.custom.d.ts @@ -166,6 +166,8 @@ export interface HttpRequestOptions { middlewareData?: Record; } +type HttpRequestOptionsWithUrl = HttpRequestOptions & { url: string }; + interface BaseHttpResponse { status: number; headers: Headers; @@ -202,16 +204,14 @@ export interface ZObject { url: string, options: HttpRequestOptions & { raw: true } ): Promise>; - ( - options: HttpRequestOptions & { raw: true; url: string } - ): Promise>; + (options: HttpRequestOptionsWithUrl & { raw: true }): Promise< + RawHttpResponse + >; (url: string, options?: HttpRequestOptions): Promise< HttpResponse >; - (options: HttpRequestOptions & { url: string }): Promise< - HttpResponse - >; + (options: HttpRequestOptionsWithUrl): Promise>; }; console: Console; @@ -289,10 +289,10 @@ export type PerformFunction, R = any> = ( ) => Promise; export type BeforeRequestMiddleware = ( - request: HttpRequestOptions, + request: HttpRequestOptionsWithUrl, z: ZObject, bundle: Bundle -) => HttpRequestOptions | Promise; +) => HttpRequestOptionsWithUrl | Promise; export type AfterResponseMiddleware = ( response: HttpResponse,