Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
feat: response size and duration metrics
Andrew Bastin9ece8adda8f2
diff --git a/helpers/network.ts b/helpers/network.tsindex 887f902cd..5d5801f85 100644--- a/helpers/network.ts+++ b/helpers/network.ts@@ -52,10 +52,16 @@ export function createRESTNetworkRequestStream(): Observable<HoppRESTResponse> {const response = new BehaviorSubject<HoppRESTResponse>({ type: "loading" })+ const timeStart = Date.now()+runAppropriateStrategy({url: req.effectiveFinalURL,}).then((res: any) => {- console.log(res)+ const timeEnd = Date.now()++ const contentLength = res.headers["content-length"]+ ? parseInt(res.headers["content-length"])+ : (res.data as ArrayBuffer).byteLengthconst resObj: HoppRESTResponse = {type: "success",@@ -66,9 +72,8 @@ export function createRESTNetworkRequestStream(value: res.headers[x],})),meta: {- // TODO: Implement- responseSize: 0,- responseDuration: 0,+ responseSize: contentLength,+ responseDuration: timeEnd - timeStart,},}response.next(resObj)