From f90abf29c40c7f08c5149e5878134ec3f32f38ea Mon Sep 17 00:00:00 2001 From: biniam Date: Thu, 1 Feb 2018 15:48:19 -0500 Subject: [PATCH] fixup! apply feedback --- packages/rest/src/parser.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/rest/src/parser.ts b/packages/rest/src/parser.ts index e4c82f6b5e65..8c6696d4d022 100644 --- a/packages/rest/src/parser.ts +++ b/packages/rest/src/parser.ts @@ -18,7 +18,9 @@ type HttpError = HttpErrors.HttpError; // tslint:disable-next-line:no-any type MaybeBody = any | undefined; -const jsonBodyAsync = promisify(require('body/json')); +const parseJsonBody: (req: ServerRequest) => Promise = promisify( + require('body/json'), +); /** * Get the content-type header value from the request @@ -67,7 +69,7 @@ function loadRequestBodyIfNeeded( return Promise.reject(err); } - return jsonBodyAsync(request).catch((err: HttpError) => { + return parseJsonBody(request).catch((err: HttpError) => { err.statusCode = 400; return Promise.reject(err); });