Skip to content

Commit

Permalink
feat(client): support http method in req middleware (#87)
Browse files Browse the repository at this point in the history
* feat(client): support http method in req middleware

* fix(client): fix required property
  • Loading branch information
drochetti authored Sep 19, 2024
1 parent 4da11f3 commit 39089b2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libs/client/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@fal-ai/serverless-client",
"description": "The fal serverless JS/TS client",
"version": "0.14.2",
"version": "0.14.3",
"license": "MIT",
"repository": {
"type": "git",
Expand Down
5 changes: 3 additions & 2 deletions libs/client/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
*
* **Note:** This is a simplified version of the `RequestConfig` type from the
* `fetch` API. It contains only the properties that are relevant for the
* `fal-serverless` client. It also works around the fact that the `fetch` API
* `Request` does not support mutability, its clone method has critical limitations
* fal client. It also works around the fact that the `fetch` API `Request`
* does not support mutability, its clone method has critical limitations
* to our use case.
*/
export type RequestConfig = {
url: string;
method: string;
headers?: Record<string, string | string[]>;
};

Expand Down
1 change: 1 addition & 0 deletions libs/client/src/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export async function dispatchRequest<Input, Output>(

const { url, headers } = await requestMiddleware({
url: targetUrl,
method: method.toUpperCase(),
});
const authHeader = credentials ? { Authorization: `Key ${credentials}` } : {};
const requestHeaders = {
Expand Down

0 comments on commit 39089b2

Please sign in to comment.