Skip to content

Commit 9494177

Browse files
author
Alex Plischke
authored
feat: Add support for region us-east-4 (#13)
* feat: Add support for region us-east-4 * Fix invalid URL when no region is specified
1 parent ef0534e commit 9494177

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,19 @@ import FormData from "form-data";
33
import * as stream from "stream";
44

55
// The Sauce Labs region.
6-
export type Region = 'us-west-1' | 'eu-central-1' | 'staging';
6+
export type Region = 'us-west-1' | 'us-east-4' | 'eu-central-1' | 'staging';
77

88
const apiURLMap = new Map<Region, string>([
99
['us-west-1', 'https://api.us-west-1.saucelabs.com/v1/testcomposer'],
10+
['us-east-4', 'https://api.us-east-4.saucelabs.com/v1/testcomposer'],
1011
['eu-central-1', 'https://api.eu-central-1.saucelabs.com/v1/testcomposer'],
1112
['staging', 'https://api.staging.saucelabs.net/v1/testcomposer']
1213
]
1314
);
1415

1516
const appURLMap = new Map<Region, string>([
1617
['us-west-1', 'https://app.saucelabs.com'],
18+
['us-east-4', 'https://app.us-east-4.saucelabs.com'],
1719
['eu-central-1', 'https://app.eu-central-1.saucelabs.com'],
1820
['staging', 'https://app.staging.saucelabs.net']
1921
]
@@ -78,7 +80,7 @@ export class TestComposer {
7880

7981
constructor(opts: Options) {
8082
this.opts = opts;
81-
this.url = apiURLMap.get(opts.region) || 'us-west-1';
83+
this.url = apiURLMap.get(opts.region) || apiURLMap.get('us-west-1') as string;
8284
this.requestConfig = {auth: {username: this.opts.username, password: this.opts.accessKey}, headers: opts.headers};
8385
}
8486

0 commit comments

Comments
 (0)