diff --git a/package-lock.json b/package-lock.json index df95204..07b5952 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "7.1.1", "license": "MIT", "dependencies": { - "axios": "^1.6.2", + "axios": "^1.6.0", "configcat-common": "^8.1.1", "tslib": "^2.4.1" }, @@ -39,7 +39,7 @@ "karma-webpack": "^5.0.0", "mocha": "^10.2.0", "ts-loader": "^9.3.1", - "typescript": "^4.0.2", + "typescript": "^5.2.2", "webpack": "^5.77.0", "webpack-auto-inject-version": "^1.2.2", "webpack-cli": "^4.10.0" @@ -1604,9 +1604,9 @@ } }, "node_modules/axios": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", - "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.0.tgz", + "integrity": "sha512-EZ1DYihju9pwVB+jg67ogm+Tmqc6JmhamRN6I4Zt8DfZu5lbcQGw3ozH9lFejSJgs/ibaef3A9PMXPLeefFGJg==", "dependencies": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", @@ -9367,16 +9367,16 @@ "dev": true }, "node_modules/typescript": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.2.tgz", - "integrity": "sha512-e4ERvRV2wb+rRZ/IQeb3jm2VxBsirQLpQhdxplZ2MEzGvDkkMmPglecnNDfSUBivMjP93vRbngYYDQqQ/78bcQ==", + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", + "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", "dev": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=14.17" } }, "node_modules/ua-parser-js": { @@ -11363,9 +11363,9 @@ "dev": true }, "axios": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", - "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.0.tgz", + "integrity": "sha512-EZ1DYihju9pwVB+jg67ogm+Tmqc6JmhamRN6I4Zt8DfZu5lbcQGw3ozH9lFejSJgs/ibaef3A9PMXPLeefFGJg==", "requires": { "follow-redirects": "^1.15.0", "form-data": "^4.0.0", @@ -17361,9 +17361,9 @@ "dev": true }, "typescript": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.2.tgz", - "integrity": "sha512-e4ERvRV2wb+rRZ/IQeb3jm2VxBsirQLpQhdxplZ2MEzGvDkkMmPglecnNDfSUBivMjP93vRbngYYDQqQ/78bcQ==", + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", + "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", "dev": true }, "ua-parser-js": { diff --git a/package.json b/package.json index 6abebc1..8d16fcc 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "url": "https://github.com/configcat/nuxt-sdk/issues" }, "dependencies": { - "axios": "^1.6.2", + "axios": "^1.6.0", "configcat-common": "^8.1.1", "tslib": "^2.4.1" }, @@ -75,7 +75,7 @@ "karma-webpack": "^5.0.0", "mocha": "^10.2.0", "ts-loader": "^9.3.1", - "typescript": "^4.0.2", + "typescript": "^5.2.2", "webpack": "^5.77.0", "webpack-auto-inject-version": "^1.2.2", "webpack-cli": "^4.10.0" diff --git a/src/ConfigFetcher.ts b/src/ConfigFetcher.ts index 17efdf8..a636280 100644 --- a/src/ConfigFetcher.ts +++ b/src/ConfigFetcher.ts @@ -6,7 +6,7 @@ import { FetchError } from "configcat-common"; export class HttpConfigFetcher implements IConfigFetcher { async fetchLogic(options: OptionsBase, lastEtag: string | null): Promise { // If we are not running in browser set the If-None-Match header. - const headers: AxiosRequestHeaders = typeof window !== "undefined" || !lastEtag + const headers: {} = typeof window !== "undefined" || !lastEtag // NOTE: It's intentional that we don't specify the If-None-Match header. // The browser automatically handles it, adding it manually would cause an unnecessary CORS OPTIONS request. ? {} @@ -52,10 +52,10 @@ export class HttpConfigFetcher implements IConfigFetcher { throw err; } - const { status: statusCode, statusText: reasonPhrase } = response; - if (response.status === 200) { - const eTag = response.headers.etag as string; - return { statusCode, reasonPhrase, eTag, body: response.data }; + const { status: statusCode, statusText: reasonPhrase } = response!; + if (response!.status === 200) { + const eTag = response!.headers.etag as string; + return { statusCode, reasonPhrase, eTag, body: response!.data }; } return { statusCode, reasonPhrase }; diff --git a/test/HttpTests.ts b/test/HttpTests.ts index b0351f5..5d4b017 100644 --- a/test/HttpTests.ts +++ b/test/HttpTests.ts @@ -1,4 +1,4 @@ -import axios, { AxiosError } from "axios"; +import axios, { AxiosError, InternalAxiosRequestConfig } from "axios"; import AxiosMockAdapter, { } from "axios-mock-adapter"; import { assert } from "chai"; import { LogLevel } from "../src/index"; @@ -17,7 +17,7 @@ describe("HTTP tests", () => { try { axiosMock.onGet().reply(async config => { await new Promise(resolve => setTimeout(resolve, requestTimeoutMs)); - throw new AxiosError(`timeout of ${config.timeout}ms exceeded`, "ECONNABORTED", config, {}, void 0); + throw new AxiosError(`timeout of ${config.timeout}ms exceeded`, "ECONNABORTED", config as InternalAxiosRequestConfig, {}, void 0); }); const logger = new FakeLogger(); @@ -105,7 +105,7 @@ describe("HTTP tests", () => { try { axiosMock.onGet().reply(config => { - throw new AxiosError(errorMessage, "ECONNABORTED", config, {}, void 0); + throw new AxiosError(errorMessage, "ECONNABORTED", config as InternalAxiosRequestConfig, {}, void 0); }); const logger = new FakeLogger();