Skip to content

Commit d5632e7

Browse files
committed
Removed the request-response times from headers.
Signed-off-by: Vilem Obratil <[email protected]>
1 parent 8ea15e6 commit d5632e7

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

e2e/tests/api/fixtures.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,15 @@ export const discoverTokenEndpoint = async (
8787
return envInfo.OIDC_SERVER_URL ?? null;
8888
};
8989

90+
declare module 'axios' {
91+
export interface AxiosRequestConfig {
92+
sentAt?: number;
93+
}
94+
export interface AxiosResponse {
95+
duration?: number;
96+
}
97+
}
98+
9099
const initAxiosInstance = async (
91100
axiosInstance: AxiosInstance,
92101
baseURL?: string,
@@ -110,7 +119,9 @@ const initAxiosInstance = async (
110119
// Measure request start time
111120
axiosInstance.interceptors.request.use(
112121
(config) => {
113-
config.headers['request-startTime'] = new Date().getTime();
122+
// config.headers['request-startTime'] = new Date().getTime();
123+
// return config
124+
config.sentAt = Date.now();
114125
return config
115126
}
116127
);
@@ -151,11 +162,16 @@ const initAxiosInstance = async (
151162
// Measure response reception time
152163
axiosInstance.interceptors.response.use(
153164
(response) => {
154-
const currentTime = new Date().getTime()
155-
const startTime = response.config.headers['request-startTime']
165+
// const currentTime = new Date().getTime()
166+
// const startTime = response.config.headers['request-startTime']
156167

157-
response.headers['request-duration'] = currentTime - startTime
168+
// response.headers['request-duration'] = currentTime - startTime
158169

170+
// return response
171+
172+
if (response.config.sentAt != null) {
173+
response.duration = Date.now() - response.config.sentAt;
174+
}
159175
return response
160176
})
161177
};

0 commit comments

Comments
 (0)