Skip to content

Commit

Permalink
Upgrade axios (#389)
Browse files Browse the repository at this point in the history
  • Loading branch information
andersrognstad authored Jan 2, 2024
1 parent a9999f5 commit 70c64a5
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 59 deletions.
104 changes: 55 additions & 49 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"@types/styled-components": "5.1.26",
"amplitude-js": "8.21.3",
"autoprefixer": "10.4.13",
"axios": "0.26.1",
"axios": "1.6.3",
"classnames": "2.3.2",
"connect-redis": "4.0.4",
"core-js": "3.27.1",
Expand Down
6 changes: 3 additions & 3 deletions src/api/axios.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import axios, { AxiosError, AxiosRequestHeaders } from 'axios';
import axios, { AxiosError } from 'axios';
import {
accessDeniedError,
ApiErrorException,
Expand All @@ -15,8 +15,8 @@ export const NAV_PERSONIDENT_HEADER = 'nav-personident';

export const defaultRequestHeaders = (
personIdent?: string
): AxiosRequestHeaders => {
const headers: AxiosRequestHeaders = {
): Record<string, string> => {
const headers: Record<string, string> = {
'Content-Type': 'application/json',
[NAV_CONSUMER_ID_HEADER]: NAV_CONSUMER_ID,
[NAV_CALL_ID_HEADER]: `${NAV_CONSUMER_ID}-${generateUUID()}`,
Expand Down
2 changes: 1 addition & 1 deletion test/stubs/stubAktivVeileder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import axios from 'axios';
import { nockBasePath } from './nockDefaults';

export const stubAktivVeileder = () => {
axios.defaults.adapter = require('axios/lib/adapters/http');
axios.defaults.adapter = 'http';

nock(nockBasePath)
.get(`${SYFOVEILEDER_ROOT}/veileder/self`)
Expand Down
2 changes: 1 addition & 1 deletion test/stubs/stubChangelogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { changelogsMock } from '../../mock/data/changelogsMock';
import { nockBasePath } from './nockDefaults';

export const stubChangelogs = () => {
axios.defaults.adapter = require('axios/lib/adapters/http');
axios.defaults.adapter = 'http';

nock(nockBasePath)
.get(CHANGELOG_ROOT)
Expand Down
2 changes: 1 addition & 1 deletion test/stubs/stubModiaContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import axios from 'axios';
import { nockBasePath } from './nockDefaults';

export const stubModiaContext = () => {
axios.defaults.adapter = require('axios/lib/adapters/http');
axios.defaults.adapter = 'http';

nock(nockBasePath)
.get(`${MODIACONTEXTHOLDER_ROOT}/context/aktivenhet`)
Expand Down
2 changes: 1 addition & 1 deletion test/stubs/stubPersonoversikt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import axios from 'axios';
import { nockBasePath } from './nockDefaults';

export const stubPersonoversikt = () => {
axios.defaults.adapter = require('axios/lib/adapters/http');
axios.defaults.adapter = 'http';

nock(nockBasePath)
.get(`${PERSONOVERSIKT_ROOT}/enhet/${aktivEnhetMock.aktivEnhet}`)
Expand Down
2 changes: 1 addition & 1 deletion test/stubs/stubPersonregister.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import axios from 'axios';
import { nockBasePath } from './nockDefaults';

export const stubPersonregister = () => {
axios.defaults.adapter = require('axios/lib/adapters/http');
axios.defaults.adapter = 'http';

nock(nockBasePath)
.post(`${SYFOPERSON_ROOT}/person/info`)
Expand Down
2 changes: 1 addition & 1 deletion test/stubs/stubVeiledere.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import axios from 'axios';
import { nockBasePath } from './nockDefaults';

export const stubVeiledere = () => {
axios.defaults.adapter = require('axios/lib/adapters/http');
axios.defaults.adapter = 'http';

nock(nockBasePath)
.get(`${SYFOVEILEDER_ROOT}/veiledere/enhet/${aktivEnhetMock.aktivEnhet}`)
Expand Down

0 comments on commit 70c64a5

Please sign in to comment.