eshala dorost she
This commit is contained in:
+12
-3
@@ -41,8 +41,11 @@ class FunctionsClient {
|
||||
if (!region) {
|
||||
region = this.region;
|
||||
}
|
||||
// Add region as query parameter using URL API
|
||||
const url = new URL(`${this.url}/${functionName}`);
|
||||
if (region && region !== 'any') {
|
||||
_headers['x-region'] = region;
|
||||
url.searchParams.set('forceFunctionRegion', region);
|
||||
}
|
||||
let body;
|
||||
if (functionArgs &&
|
||||
@@ -70,7 +73,7 @@ class FunctionsClient {
|
||||
body = JSON.stringify(functionArgs);
|
||||
}
|
||||
}
|
||||
const response = yield this.fetch(`${this.url}/${functionName}`, {
|
||||
const response = yield this.fetch(url.toString(), {
|
||||
method: method || 'POST',
|
||||
// headers priority is (high to low):
|
||||
// 1. invoke-level headers
|
||||
@@ -106,10 +109,16 @@ class FunctionsClient {
|
||||
// default to text
|
||||
data = yield response.text();
|
||||
}
|
||||
return { data, error: null };
|
||||
return { data, error: null, response };
|
||||
}
|
||||
catch (error) {
|
||||
return { data: null, error };
|
||||
return {
|
||||
data: null,
|
||||
error,
|
||||
response: error instanceof types_1.FunctionsHttpError || error instanceof types_1.FunctionsRelayError
|
||||
? error.context
|
||||
: undefined,
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@supabase/functions-js",
|
||||
"version": "2.4.4",
|
||||
"version": "2.4.5",
|
||||
"description": "JS Client library to interact with Supabase Functions.",
|
||||
"main": "dist/main/index.js",
|
||||
"module": "dist/module/index.js",
|
||||
|
||||
Reference in New Issue
Block a user