File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -6,9 +6,9 @@ export class FunctionsClient {
6
6
protected headers : { [ key : string ] : string }
7
7
protected fetch : Fetch
8
8
9
- constructor ( url : string , headers : { [ key : string ] : string } , customFetch ?: Fetch ) {
9
+ constructor ( url : string , headers ? : { [ key : string ] : string } , customFetch ?: Fetch ) {
10
10
this . url = url
11
- this . headers = headers
11
+ this . headers = headers ?? { }
12
12
13
13
this . fetch = resolveFetch ( customFetch )
14
14
}
@@ -29,10 +29,10 @@ export class FunctionsClient {
29
29
* `body`: the body of the request
30
30
* `responseType`: how the response should be parsed. The default is `json`
31
31
*/
32
- async invoke (
32
+ async invoke < T = string > (
33
33
functionName : string ,
34
34
invokeOptions ?: FunctionInvokeOptions
35
- ) : Promise < { data : string | null ; error : Error | null } > {
35
+ ) : Promise < { data : T | null ; error : Error | null } > {
36
36
try {
37
37
const { headers, body } = invokeOptions ?? { }
38
38
const response = await this . fetch ( `${ this . url } /${ functionName } ` , {
You can’t perform that action at this time.
0 commit comments