File tree Expand file tree Collapse file tree 1 file changed +22
-5
lines changed Expand file tree Collapse file tree 1 file changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -627,25 +627,42 @@ class ServerClient {
627627   * HTTP POST request with the provided body. 
628628   * 
629629   * @param  url - The URL of the workflow's HTTP interface. 
630-    * @param  body - The body to send with the request. 
630+    * @param  opts - The options for the request. 
631+    * @param  opts.body - The body of the request. It must be a JSON-serializable 
632+    * value (e.g. an object, `null`, a string, etc.). 
633+    * @param  opts.headers - The headers to include in the request. Note that the 
634+    * `Authorization` header will always be set with an OAuth access token 
635+    * retrieved by the client. 
636+    * 
631637   * @returns  A promise resolving to the response from the workflow. 
632638   * 
633639   * @example  
634640   * ```typescript 
635641   * const response: JSON = await client.invokeWorkflow( 
636642   *   "https://eoy64t2rbte1u2p.m.pipedream.net", 
637643   *   { 
638-    *     foo: 123, 
639-    *     bar: "abc", 
640-    *     baz: null, 
644+    *     body: { 
645+    *       foo: 123, 
646+    *       bar: "abc", 
647+    *       baz: null, 
648+    *     }, 
649+    *     headers: { 
650+    *       "Accept": "application/json", 
651+    *     }, 
641652   *   }, 
642653   * ); 
643654   */ 
644-   async  invokeWorkflow ( url : string ,  body : unknown  =  null ) : Promise < unknown >  { 
655+   async  invokeWorkflow ( url : string ,  opts : RequestOptions  =  { } ) : Promise < unknown >  { 
656+     const  { 
657+       body =  null , 
658+       headers =  { } , 
659+     }  =  opts ; 
660+ 
645661    return  this . _makeRequest ( "" ,  { 
646662      baseURL : url , 
647663      method : "POST" , 
648664      headers : { 
665+         ...headers , 
649666        "Authorization" : await  this . _oauthAuthorizationHeader ( ) , 
650667      } , 
651668      body : JSON . stringify ( body ) , 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments