diff --git a/src/index.ts b/src/index.ts index 0dd69cc..3e89840 100644 --- a/src/index.ts +++ b/src/index.ts @@ -46,12 +46,12 @@ const httpProxyMiddleware = async ( if (pathRewrite) { req.url = rewritePath(req.url as string, pathRewrite); } - if (["POST", "PUT"].indexOf(req.method as string) >= 0 && typeof req.body === "object") { + if (["POST", "PUT", "PATCH"].indexOf(req.method as string) >= 0 && typeof req.body === "object") { req.body = JSON.stringify(req.body); } proxy .once("proxyReq", ((proxyReq: any, req: any): void => { - if (["POST", "PUT"].indexOf(req.method as string) >= 0 && typeof req.body === "string") { + if (["POST", "PUT", "PATCH"].indexOf(req.method as string) >= 0 && typeof req.body === "string") { proxyReq.write(req.body); proxyReq.end(); }