import http from 'http'; class Response extends http.IncomingMessage { body?: string; } export function get ( headers: http.OutgoingHttpHeaders = {} ): Promise { return new Promise ((resolve) => { http.get ('http://localhost:3000', { headers }, (res: Response) => { let body = ''; res.on ('data', (d) => { body += d; }); res.on ('end', () => { res.body = body; resolve (res); }); }); }); }