Skip to content

Commit 4abb398

Browse files
authored
[TT-8124]: bump axios to v1 (#63)
* feat: bump axios to v1 * chore: bump typescript * chore: bump to v5.0.0 * tests: fix tests
1 parent 4d11a11 commit 4abb398

File tree

10 files changed

+81
-60
lines changed

10 files changed

+81
-60
lines changed

package-lock.json

Lines changed: 55 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": false,
33
"name": "@what3words/api",
4-
"version": "4.0.9",
4+
"version": "5.0.0",
55
"description": "what3words JavaScript API",
66
"homepage": "https://github.com/what3words/w3w-node-wrapper#readme",
77
"main": "dist/index.js",
@@ -24,7 +24,7 @@
2424
"posttest": "npm run lint"
2525
},
2626
"peerDependencies": {
27-
"axios": "^0.21.2",
27+
"axios": ">=1",
2828
"cross-fetch": "^3.1.5"
2929
},
3030
"peerDependenciesMeta": {
@@ -60,7 +60,7 @@
6060
"sinon": "^12.0.1",
6161
"superagent": "^8.0.8",
6262
"ts-node": "^10.4.0",
63-
"typescript": "^4.0.3"
63+
"typescript": "^5.0.0"
6464
},
6565
"engines": {
6666
"node": ">=12"

src/lib/transport/axios.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ export function axiosTransport(): Transport {
2121
const response = errorHandler({
2222
status: res.status,
2323
statusText: res.statusText,
24-
headers: res.headers,
2524
body: res.data,
25+
headers: res.headers as Record<string, string>,
2626
});
2727
return response;
2828
})

src/lib/transport/model.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ export interface TransportResponse<T> {
2626
status: number;
2727
statusText?: string;
2828
body?: T | null;
29-
headers?: { [key: string]: string };
29+
headers?: Record<string, string>;
3030
}

test/client/autosuggest.spec.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ describe('Autosuggest Client', () => {
201201
input,
202202
inputType,
203203
});
204-
} catch (err) {
204+
} catch (err: any) {
205205
err.message.should.be.equal(
206206
'You must provide language when using a speech input type'
207207
);
@@ -216,7 +216,7 @@ describe('Autosuggest Client', () => {
216216
try {
217217
// eslint-disable-next-line @typescript-eslint/no-explicit-any
218218
await client.run(undefined as any);
219-
} catch (err) {
219+
} catch (err: any) {
220220
err.message.should.be.equal('You must provide at least options.input');
221221
} finally {
222222
transportSpy.notCalled.should.be.equal(
@@ -230,7 +230,7 @@ describe('Autosuggest Client', () => {
230230

231231
try {
232232
await client.run({ input });
233-
} catch (err) {
233+
} catch (err: any) {
234234
err.message.should.be.equal('You must specify an input value');
235235
} finally {
236236
transportSpy.notCalled.should.be.equal(
@@ -248,7 +248,7 @@ describe('Autosuggest Client', () => {
248248

249249
try {
250250
await client.run({ input, clipToBoundingBox });
251-
} catch (err) {
251+
} catch (err: any) {
252252
err.message.should.be.equal(
253253
'Southwest lat must be less than or equal to northeast lat and southwest lng must be less than or equal to northeast lng'
254254
);
@@ -268,7 +268,7 @@ describe('Autosuggest Client', () => {
268268

269269
try {
270270
await client.run({ input, clipToBoundingBox });
271-
} catch (err) {
271+
} catch (err: any) {
272272
err.message.should.be.equal(
273273
'Southwest lat must be less than or equal to northeast lat and southwest lng must be less than or equal to northeast lng'
274274
);
@@ -289,7 +289,7 @@ describe('Autosuggest Client', () => {
289289

290290
try {
291291
await client.run({ input, clipToCountry });
292-
} catch (err) {
292+
} catch (err: any) {
293293
err.message.should.be.equal(
294294
'Invalid clip to country. All values must be an ISO 3166-1 alpha-2 country code'
295295
);
@@ -311,7 +311,7 @@ describe('Autosuggest Client', () => {
311311

312312
try {
313313
await client.run({ input, clipToPolygon });
314-
} catch (err) {
314+
} catch (err: any) {
315315
err.message.should.be.equal(
316316
'Invalid clip to polygon value. Array must contain at least 4 coordinates and no more than 25'
317317
);
@@ -333,7 +333,7 @@ describe('Autosuggest Client', () => {
333333

334334
try {
335335
await client.run({ input, clipToPolygon });
336-
} catch (err) {
336+
} catch (err: any) {
337337
err.message.should.be.equal(
338338
'Invalid clip to polygon value. The polygon bounds must be closed.'
339339
);
@@ -350,7 +350,7 @@ describe('Autosuggest Client', () => {
350350

351351
try {
352352
await client.run({ input, inputType });
353-
} catch (err) {
353+
} catch (err: any) {
354354
err.message.should.be.equal(
355355
'Invalid input type provided. Must provide a valid input type.'
356356
);
@@ -372,7 +372,7 @@ describe('Autosuggest Client', () => {
372372

373373
try {
374374
await client.run({ input, inputType });
375-
} catch (err) {
375+
} catch (err: any) {
376376
err.message.should.be.equal(
377377
'You must provide language when using a speech input type'
378378
);
@@ -390,7 +390,7 @@ describe('Autosuggest Client', () => {
390390

391391
try {
392392
await client.run({ input, language });
393-
} catch (err) {
393+
} catch (err: any) {
394394
err.message.should.be.equal(
395395
'Invalid language code. It must be an ISO-639-1 2 letter code.'
396396
);

0 commit comments

Comments
 (0)