feat(client): support http method in req middleware (#87)
* feat(client): support http method in req middleware * fix(client): fix required property
This commit is contained in:
parent
4da11f3060
commit
39089b2462
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@fal-ai/serverless-client",
|
"name": "@fal-ai/serverless-client",
|
||||||
"description": "The fal serverless JS/TS client",
|
"description": "The fal serverless JS/TS client",
|
||||||
"version": "0.14.2",
|
"version": "0.14.3",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
@ -3,12 +3,13 @@
|
|||||||
*
|
*
|
||||||
* **Note:** This is a simplified version of the `RequestConfig` type from the
|
* **Note:** This is a simplified version of the `RequestConfig` type from the
|
||||||
* `fetch` API. It contains only the properties that are relevant for 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
|
* fal client. It also works around the fact that the `fetch` API `Request`
|
||||||
* `Request` does not support mutability, its clone method has critical limitations
|
* does not support mutability, its clone method has critical limitations
|
||||||
* to our use case.
|
* to our use case.
|
||||||
*/
|
*/
|
||||||
export type RequestConfig = {
|
export type RequestConfig = {
|
||||||
url: string;
|
url: string;
|
||||||
|
method: string;
|
||||||
headers?: Record<string, string | string[]>;
|
headers?: Record<string, string | string[]>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -30,6 +30,7 @@ export async function dispatchRequest<Input, Output>(
|
|||||||
|
|
||||||
const { url, headers } = await requestMiddleware({
|
const { url, headers } = await requestMiddleware({
|
||||||
url: targetUrl,
|
url: targetUrl,
|
||||||
|
method: method.toUpperCase(),
|
||||||
});
|
});
|
||||||
const authHeader = credentials ? { Authorization: `Key ${credentials}` } : {};
|
const authHeader = credentials ? { Authorization: `Key ${credentials}` } : {};
|
||||||
const requestHeaders = {
|
const requestHeaders = {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user