mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-14 17:02:49 +03:00
console: have better time and payload size estimation in graphiql
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9243 GitOrigin-RevId: 74ab50ed908da659246c4fada3742d33e0fa3cd2
This commit is contained in:
parent
3492484034
commit
e7f0a521b8
@ -72,7 +72,9 @@ const requestAction = <T = any>(
|
|||||||
dispatch({ type: LOAD_REQUEST });
|
dispatch({ type: LOAD_REQUEST });
|
||||||
const startTime = new Date().getTime();
|
const startTime = new Date().getTime();
|
||||||
fetch(url, requestOptions).then(
|
fetch(url, requestOptions).then(
|
||||||
response => {
|
async response => {
|
||||||
|
const endTime = new Date().getTime();
|
||||||
|
const responseSize = (await response.clone().text()).length;
|
||||||
const contentType = response.headers.get('Content-Type');
|
const contentType = response.headers.get('Content-Type');
|
||||||
const isResponseJson = `${contentType}`.includes('application/json');
|
const isResponseJson = `${contentType}`.includes('application/json');
|
||||||
|
|
||||||
@ -95,7 +97,6 @@ const requestAction = <T = any>(
|
|||||||
dispatch({ type: DONE_REQUEST });
|
dispatch({ type: DONE_REQUEST });
|
||||||
|
|
||||||
if (requestTrackingId) {
|
if (requestTrackingId) {
|
||||||
const endTime = new Date().getTime();
|
|
||||||
const responseTimeMs = endTime - startTime;
|
const responseTimeMs = endTime - startTime;
|
||||||
const isResponseCached = response.headers.has('Cache-Control');
|
const isResponseCached = response.headers.has('Cache-Control');
|
||||||
const cacheWarning = getCacheRequestWarning(
|
const cacheWarning = getCacheRequestWarning(
|
||||||
@ -105,7 +106,6 @@ const requestAction = <T = any>(
|
|||||||
url,
|
url,
|
||||||
requestOptions.body
|
requestOptions.body
|
||||||
);
|
);
|
||||||
const responseSize = JSON.stringify(results).length * 2;
|
|
||||||
dispatch(
|
dispatch(
|
||||||
processResponseDetails(
|
processResponseDetails(
|
||||||
responseTimeMs,
|
responseTimeMs,
|
||||||
|
Loading…
Reference in New Issue
Block a user