From 785d41b6d37c4475c56fc7535881a9703104a0dc Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Fri, 11 Mar 2022 22:17:47 -0800 Subject: [PATCH] Check for empty content-type header. --- .eslintrc.json | 2 +- lib/request.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index e5f0cc94..990e0581 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -4,7 +4,7 @@ "es2020": true, "node": true }, - "extends": ["eslint:recommended", "plugin:react/recommended", "prettier", "next"], + "extends": ["eslint:recommended", "plugin:react/recommended", "prettier"], "parserOptions": { "ecmaFeatures": { "jsx": true diff --git a/lib/request.js b/lib/request.js index 89e9c655..ba1c799b 100644 --- a/lib/request.js +++ b/lib/request.js @@ -88,7 +88,7 @@ export async function getClientInfo(req, { screen }) { } export function getJsonBody(req) { - if (req.headers['content-type'].indexOf('text/plain') !== -1) { + if ((req.headers['content-type'] || '').indexOf('text/plain') !== -1) { return JSON.parse(req.body); }