chimurai / http-proxy-middleware

:zap: The one-liner node.js http-proxy middleware for connect, express, next.js and more
MIT License
10.76k stars 849 forks source link

fix(fix-request-body): improve content type check #725

Closed kevinxh closed 2 years ago

kevinxh commented 2 years ago

Description

It is common for POST request to have the content type: application/x-www-form-urlencoded; charset=UTF-8

The charset part can be set when you have a form with attribute accept-charset="utf-8"

I encountered this while using the fixRequestBody function and the content type check doesn't take the charset into account.

Screen Shot 2022-03-09 at 11 57 11 PM

Motivation and Context

How has this been tested?

Types of changes

Checklist:

chimurai commented 2 years ago

Hi, thanks for the PR.

Looks like a good improvement.

coveralls commented 2 years ago

Coverage Status

Coverage remained the same at 98.86% when pulling 1c5bd04cfee60a8b8dbba6aa39fa4512cfa37922 on kevinxh:fix-request-body-update into e9e25ca5d5548d01c227d0707b54ea15cbd8d1f4 on chimurai:master.

chimurai commented 2 years ago

Thanks for making the PR @kevinxh!

Published fix in v2.0.4