Skip to content

Commit b1d15e4

Browse files
authored
Merge pull request #22 from Kerumen/patch-1
Support PATCH method
2 parents 04e38d3 + 1575d32 commit b1d15e4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ const httpProxyMiddleware = async (
4646
if (pathRewrite) {
4747
req.url = rewritePath(req.url as string, pathRewrite);
4848
}
49-
if (["POST", "PUT"].indexOf(req.method as string) >= 0 && typeof req.body === "object") {
49+
if (["POST", "PUT", "PATCH"].indexOf(req.method as string) >= 0 && typeof req.body === "object") {
5050
req.body = JSON.stringify(req.body);
5151
}
5252
proxy
5353
.once("proxyReq", ((proxyReq: any, req: any): void => {
54-
if (["POST", "PUT"].indexOf(req.method as string) >= 0 && typeof req.body === "string") {
54+
if (["POST", "PUT", "PATCH"].indexOf(req.method as string) >= 0 && typeof req.body === "string") {
5555
proxyReq.write(req.body);
5656
proxyReq.end();
5757
}

0 commit comments

Comments
 (0)