UNPKG

@graphql-mesh/serve-runtime

Version:
22 lines (21 loc) 736 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useFetchDebug = useFetchDebug; function useFetchDebug(opts) { return { onFetch({ url, options, logger = opts.logger }) { logger = logger.child('fetch'); logger.debug('request', JSON.stringify({ url, ...(options || {}), }, null, ' ')); return function onFetchDone({ response }) { logger.debug('response', () => JSON.stringify({ url, status: response.status, headers: Object.fromEntries(response.headers.entries()), }, null, ' ')); }; }, }; }