diff --git a/CHANGELOG.md b/CHANGELOG.md index 2cf32dd8..b7fef565 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## [v1.3.1](https://github.com/chimurai/http-proxy-middleware/releases/tag/v1.3.1) + +- fix(fix-request-body): make sure the content-type exists ([#578](https://github.com/chimurai/http-proxy-middleware/pull/578)) ([oufeng](https://github.com/oufeng)) + ## [v1.3.0](https://github.com/chimurai/http-proxy-middleware/releases/tag/v1.3.0) - docs(response interceptor): align with nodejs default utf8 ([#567](https://github.com/chimurai/http-proxy-middleware/pull/567)) diff --git a/package.json b/package.json index 66fe6a5c..15495583 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "http-proxy-middleware", - "version": "1.3.0", + "version": "1.3.1", "description": "The one-liner node.js proxy middleware for connect, express and browser-sync", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/handlers/fix-request-body.ts b/src/handlers/fix-request-body.ts index 40c6c9e4..cc9d2776 100644 --- a/src/handlers/fix-request-body.ts +++ b/src/handlers/fix-request-body.ts @@ -17,7 +17,7 @@ export function fixRequestBody(proxyReq: ClientRequest, req: Request): void { proxyReq.write(bodyData); }; - if (contentType.includes('application/json')) { + if (contentType && contentType.includes('application/json')) { writeBody(JSON.stringify(req.body)); }