Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(client): support http method in req middleware #87

Merged
merged 2 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -7,7 +7,7 @@
navigator?.userAgent === "Cloudflare-Workers";

type RequestOptions = {
responseHandler?: ResponseHandler<any>;

Check warning on line 10 in libs/client/src/request.ts

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type
};

export async function dispatchRequest<Input, Output>(
Expand All @@ -30,6 +30,7 @@

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