Skip to content

Commit

Permalink
fied bug
Browse files Browse the repository at this point in the history
  • Loading branch information
rg2011 committed Feb 5, 2024
1 parent f6ccfa4 commit 0b599bf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/bindings/HTTPBinding.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'])) {
Expand All @@ -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(', '));
}
Expand Down

0 comments on commit 0b599bf

Please sign in to comment.