File tree 2 files changed +23
-1
lines changed
2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import {
11
11
export class FunctionsClient {
12
12
protected url : string
13
13
protected headers : Record < string , string >
14
+ protected region : string
14
15
protected fetch : Fetch
15
16
16
17
constructor (
@@ -25,6 +26,7 @@ export class FunctionsClient {
25
26
) {
26
27
this . url = url
27
28
this . headers = headers
29
+ this . region = 'any'
28
30
this . fetch = resolveFetch ( customFetch )
29
31
}
30
32
@@ -47,8 +49,10 @@ export class FunctionsClient {
47
49
) : Promise < FunctionsResponse < T > > {
48
50
try {
49
51
const { headers, method, body : functionArgs } = options
50
-
51
52
let _headers : Record < string , string > = { }
53
+ if ( this . region !== 'any' ) {
54
+ _headers [ 'x-region' ] = this . region
55
+ }
52
56
let body : any
53
57
if (
54
58
functionArgs &&
Original file line number Diff line number Diff line change @@ -50,6 +50,24 @@ export type FunctionInvokeOptions = {
50
50
* The HTTP verb of the request
51
51
*/
52
52
method ?: 'POST' | 'GET' | 'PUT' | 'PATCH' | 'DELETE'
53
+ /**
54
+ * The Region to invoke the function in.
55
+ */
56
+ region ?: 'any'
57
+ | 'ap-northeast-1'
58
+ | 'ap-northeast-2'
59
+ | 'ap-south-1'
60
+ | 'ap-southeast-1'
61
+ | 'ap-southeast-2'
62
+ | 'ca-central-1'
63
+ | 'eu-central-1'
64
+ | 'eu-west-1'
65
+ | 'eu-west-2'
66
+ | 'eu-west-3'
67
+ | 'sa-east-1'
68
+ | 'us-east-1'
69
+ | 'us-west-1'
70
+ | 'us-west-2'
53
71
/**
54
72
* The body of the request.
55
73
*/
You can’t perform that action at this time.
0 commit comments