diff --git a/CHANGELOG.md b/CHANGELOG.md index cff0bd5..aebdb48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### 2.5.0 + +- added fetch interceptor to the Backend Options [133](https://github.com/i18next/i18next-http-backend/pull/133) + ### 2.4.3 - fix: overriding options diff --git a/package.json b/package.json index 6cc75ff..1f5e8ec 100644 --- a/package.json +++ b/package.json @@ -31,27 +31,27 @@ }, "types": "./index.d.mts", "devDependencies": { - "@babel/cli": "7.23.0", - "@babel/core": "7.23.3", - "@babel/preset-env": "7.23.3", + "@babel/cli": "7.23.9", + "@babel/core": "7.23.9", + "@babel/preset-env": "7.23.9", "babel-plugin-add-module-exports": "1.0.4", "browserify": "17.0.0", "dtslint": "4.2.1", - "eslint": "8.53.0", + "eslint": "8.56.0", "eslint-config-standard": "17.1.0", - "eslint-plugin-import": "2.29.0", - "eslint-plugin-n": "16.3.1", + "eslint-plugin-import": "2.29.1", + "eslint-plugin-n": "16.6.2", "eslint-plugin-promise": "6.1.1", "eslint-plugin-require-path-exists": "1.1.9", "eslint-plugin-standard": "5.0.0", "expect.js": "0.3.1", - "i18next": "23.7.1", + "i18next": "23.9.0", "json-server": "0.17.4", "json5": "2.2.3", - "mocha": "10.2.0", + "mocha": "10.3.0", "tslint": "5.20.1", - "tsd": "0.29.0", - "typescript": "5.2.2", + "tsd": "0.30.5", + "typescript": "5.3.3", "uglify-js": "3.17.4", "xmlhttprequest": "1.8.0" }, @@ -77,7 +77,7 @@ "compile": "npm run compile:esm && npm run compile:cjs", "browser": "browserify --ignore cross-fetch --standalone i18nextHttpBackend cjs/index.js -o i18nextHttpBackend.js && uglifyjs i18nextHttpBackend.js --compress --mangle -o i18nextHttpBackend.min.js", "build": "npm run compile && npm run browser", - "test:xmlhttpreq": "mocha test -R spec --require test/fixtures/xmlHttpRequest.cjs --exit --experimental-modules", + "test:xmlhttpreq": "mocha test -R spec --require test/fixtures/xmlHttpRequest.cjs --exit --experimental-modules", "test:fetch": "mocha test -R spec --exit --experimental-modules", "test": "npm run lint && npm run build && npm run test:fetch && npm run test:xmlhttpreq && npm run test:typescript", "test:typescript": "tslint --project tsconfig.json && tsd", diff --git a/test/http.spec.js b/test/http.spec.js index 20165d3..71caca6 100644 --- a/test/http.spec.js +++ b/test/http.spec.js @@ -48,21 +48,16 @@ describe(`http backend using ${hasXMLHttpRequest() ? 'XMLHttpRequest' : 'fetch'} expect(errO).to.be(null) expect(dataO).to.eql({ key: 'passing' }) expect(done).to.be(true) - expect(logs).to.eql([ - [ - 'http://localhost:5001/locales/en/test', - { - method: 'GET', - headers: { - 'User-Agent': 'i18next-http-backend (node/v20.8.0; linux x64)' - }, - mode: 'cors', - credentials: 'same-origin', - cache: 'default', - body: undefined - } - ] - ]) + expect(logs).to.have.length(1) + expect(logs[0]).to.have.length(2) + expect(logs[0][0]).to.eql('http://localhost:5001/locales/en/test') + expect(logs[0][1]).to.have.property('method', 'GET') + expect(logs[0][1]).to.have.property('headers') + expect(logs[0][1].headers).to.have.property('User-Agent') + expect(logs[0][1]).to.have.property('mode', 'cors') + expect(logs[0][1]).to.have.property('credentials', 'same-origin') + expect(logs[0][1]).to.have.property('cache', 'default') + expect(logs[0][1]).to.have.property('body') }) }