Timo Hocker 4c27d0eace
Some checks failed
continuous-integration/drone/push Build is failing
auth handler tests
2021-01-01 14:14:19 +01:00

29 lines
622 B
TypeScript

import http from 'http';
export 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);
});
});
});
}
export function modify_signature (signature: string): string {
const dec = signature.split ('.');
dec[1] = '';
return dec.join ('.');
}