import { stringify } from "./safeJson" ; import { Header , NetworkRequest } from "../hooks/useNetworkMonitor" ; const stringifyHeaders = ( headers = [ ] ) => { return headers . map ( ( header ) => { return `${ header . name }: ${ header . value }` ; } ) . join ( ", " ) ; } ; export const getHeaderSearchContent = ( networkRequest ) : string => { const requestHeaderText = stringifyHeaders ( networkRequest . request . headers ) ; const responseHeaderText = stringifyHeaders ( networkRequest . response ?. headers ) ; return [ requestHeaderText , responseHeaderText ] . join ( ", " ) ; } ; export const getRequestSearchContent = ( networkRequest ) : string => { return networkRequest . request . body . map ( ( body ) => { return body . query + " " + stringify ( body . variables ) ; } ) . join ( ", " ) ; } ; export const getResponseSearchContent = ( networkRequest ) : string => { return networkRequest . response ?. body || "" ; } ;