work on getting close to refactor

This commit is contained in:
Boki 2025-06-22 11:08:26 -04:00
parent 8550b1de57
commit a63ccc96f5
15 changed files with 129 additions and 178 deletions

View file

@ -13,8 +13,7 @@
"@stock-bot/config": "workspace:*",
"@stock-bot/logger": "workspace:*",
"@stock-bot/cache": "workspace:*",
"@stock-bot/types": "workspace:*",
"@stock-bot/http": "workspace:*"
"@stock-bot/types": "workspace:*"
},
"devDependencies": {
"@types/node": "^20.11.0",

View file

@ -3,6 +3,8 @@
* Drop-in replacement for native fetch with logging support
*/
// import { RequestInfo, RequestInit, Response } from '@types/bun';
export function fetch(
input: RequestInfo | URL,
init?: RequestInit & { logger?: any }
@ -10,8 +12,10 @@ export function fetch(
const logger = init?.logger || console;
const url = typeof input === 'string' ? input : input instanceof URL ? input.href : input.url;
const method = init?.method || 'GET';
const headers = init?.headers || {};
const proxy = init?.proxy || null;
logger.debug('HTTP request', { method, url });
logger.debug('HTTP request', { method, url, headers });
return globalThis.fetch(input, init).then(response => {
logger.debug('HTTP response', {