Allow to set HTTP response code on Webhook-Node

This commit is contained in:
Jan Oberhauser
2019-08-28 17:03:35 +02:00
parent 1ff038b563
commit 1ff456d77c
5 changed files with 38 additions and 11 deletions

View File

@@ -53,9 +53,13 @@ export function basicAuthAuthorizationError(resp: Response, realm: string, messa
}
export function sendSuccessResponse(res: Response, data: any, raw?: boolean) { // tslint:disable-line:no-any
export function sendSuccessResponse(res: Response, data: any, raw?: boolean, responseCode?: number) { // tslint:disable-line:no-any
res.setHeader('Content-Type', 'application/json');
if (responseCode !== undefined) {
res.status(responseCode);
}
if (raw === true) {
res.send(JSON.stringify(data));
return;