From 0b599bfc146957d62a073e6c6b0f888f56d79120 Mon Sep 17 00:00:00 2001 From: rg2011 <52279456+rg2011@users.noreply.github.com> Date: Mon, 5 Feb 2024 08:11:18 +0100 Subject: [PATCH] fied bug --- lib/bindings/HTTPBinding.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bindings/HTTPBinding.js b/lib/bindings/HTTPBinding.js index 4e29ac7ec..90423dbf8 100644 --- a/lib/bindings/HTTPBinding.js +++ b/lib/bindings/HTTPBinding.js @@ -77,7 +77,7 @@ function parserBody() { // use typeis.is on a trimmed header, instead of // req.is on the request, to work around // https://github.com/jshttp/type-is/issues/52 - const contentType = req.get('content-type').split(';').unshift().trim(); + const contentType = req.get('content-type').split(';').shift().trim(); if (typeis.is(contentType, ['text/plain'])) { text(req, res, next) } else if (typeis.is(contentType, ['application/octet-stream'])) { @@ -97,7 +97,7 @@ function checkPostContentType(...mimeTypes) { // use typeis.is on a trimmed header, instead of // req.is on the request, to work around // https://github.com/jshttp/type-is/issues/52 - const contentType = req.get('content-type').split(';').unshift().trim(); + const contentType = req.get('content-type').split(';').shift().trim(); if (!typeis.hasBody(req) || !typeis.is(contentType, mimeTypes)) { err = new errors.UnsupportedType(mimeTypes.join(', ')); }