Timo Hocker 2f342b31f7
Some checks failed
continuous-integration/drone/push Build is failing
update
2020-12-30 17:21:56 +01:00

24 lines
472 B
TypeScript

import http from 'http';
class Response extends http.IncomingMessage {
body?: string;
}
export
function get (
headers: http.OutgoingHttpHeaders = {}
): Promise<Response> {
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);
});
});
});
}