From 01ac2bd7186a4400d6d8331ffff9754884c6a1a6 Mon Sep 17 00:00:00 2001 From: Emily Harber Date: Wed, 10 Feb 2021 16:36:19 -0500 Subject: [PATCH] default status to 200 --- src/utils/graphql_proxy.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/graphql_proxy.ts b/src/utils/graphql_proxy.ts index 12b43c252..d1131b0e8 100644 --- a/src/utils/graphql_proxy.ts +++ b/src/utils/graphql_proxy.ts @@ -24,6 +24,7 @@ export default async function graphqlProxy(userReq: http.IncomingMessage, userRe }); userReq.on('end', async () => { + let status = 200; let reqBodyObject: Record | undefined; try { reqBodyObject = JSON.parse(reqBodyString); @@ -40,7 +41,6 @@ export default async function graphqlProxy(userReq: http.IncomingMessage, userRe const response = await client.query(options); body = response.body; } catch (err) { - let status; switch (err.constructor.name) { case 'MissingRequiredArgument': status = 400; @@ -54,9 +54,9 @@ export default async function graphqlProxy(userReq: http.IncomingMessage, userRe default: status = 500; } - userRes.statusCode = status; body = err.message; } finally { + userRes.statusCode = status; userRes.end(JSON.stringify(body)); } return resolve();