Skip to content

Commit 003b035

Browse files
authored
chore: Regional API domain processing (#1170)
* chore: Regional API domain processing * chore: Regional API domain processing
1 parent 6e3509f commit 003b035

File tree

2 files changed

+0
-52
lines changed

2 files changed

+0
-52
lines changed

spec/unit/rest/Twilio.spec.js

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -128,31 +128,6 @@ describe("client", () => {
128128
.then(() => scope.done());
129129
});
130130
});
131-
132-
it("should not change the value of edge and region", () => {
133-
client = new Twilio("ACXXXXXXXX", "test-password");
134-
client.region = "us1";
135-
client.edge = "sydney";
136-
expect(client.region).toEqual("us1");
137-
expect(client.edge).toEqual("sydney");
138-
});
139-
140-
it("should not change the value of edge", () => {
141-
client = new Twilio("ACXXXXXXXX", "test-password", { edge: "dublin" });
142-
expect(client.edge).toEqual("dublin");
143-
});
144-
145-
it("should use edge set in request function when region is given", () => {
146-
client = new Twilio("ACXXXXXXXX", "test-password", { region: "au1" });
147-
expect(client.region).toEqual("au1");
148-
const scope = nock("https://api.sydney.au1.twilio.com")
149-
.get("/")
150-
.reply(200, "test response");
151-
client
152-
.request({ method: "GET", uri: "https://api.twilio.com" })
153-
.then(() => scope.done());
154-
expect(client.edge).toEqual("sydney");
155-
});
156131
});
157132

158133
describe("adding user agent extensions", () => {

src/base/BaseTwilio.ts

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,6 @@ const util = require("util"); /* jshint ignore:line */
1212
const RestException = require("../base/RestException"); /* jshint ignore:line */
1313

1414
namespace Twilio {
15-
export const regionToEdgeMap = new Map<string, string>([
16-
["au1", "sydney"],
17-
["br1", "sao-paulo"],
18-
["de1", "frankfurt"],
19-
["ie1", "dublin"],
20-
["jp1", "tokyo"],
21-
["jp2", "osaka"],
22-
["sg1", "singapore"],
23-
["us1", "ashburn"],
24-
["us2", "umatilla"],
25-
]);
26-
2715
export interface ClientOpts {
2816
httpClient?: RequestClient;
2917
accountSid?: string;
@@ -224,21 +212,6 @@ namespace Twilio {
224212
/* jshint ignore:end */
225213

226214
request(opts: RequestOpts): Promise<any> {
227-
if (
228-
(this.edge !== undefined && this.region === undefined) ||
229-
(this.edge === undefined && this.region !== undefined)
230-
) {
231-
console.warn(
232-
"[DEPRECATION WARNING] For regional processing, DNS is of format product.edge.region.twilio.com;otherwise use product.twilio.com"
233-
);
234-
}
235-
if (this.region !== undefined && this.edge === undefined) {
236-
const mappedEdge = regionToEdgeMap.get(this.region);
237-
if (mappedEdge) {
238-
console.warn("Setting edge value from the region mapping");
239-
this.edge = mappedEdge;
240-
}
241-
}
242215
opts = opts || {};
243216

244217
if (!opts.method) {

0 commit comments

Comments
 (0)