Skip to content

Breaking change in 2.0.1 #650

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks done
ThomWright opened this issue Aug 11, 2021 · 3 comments · Fixed by #700 or #882
Closed
2 tasks done

Breaking change in 2.0.1 #650

ThomWright opened this issue Aug 11, 2021 · 3 comments · Fixed by #700 or #882
Labels

Comments

@ThomWright
Copy link

yarn why http-proxy-middleware OR npm ls http-proxy-middleware output (mask private folder names with *****)

public-api@1.1.0 *****/public-api
└── http-proxy-middleware@2.0.1

Describe the bug (be clear and concise)

A breaking change was released with 2.0.1. The response type for onProxyRes used to be express.Response, but is now http.Response. This should have been a major version change.

Step-by-step reproduction instructions

1. Install 2.0.0. Use e.g. `res.status(200).send()` in `onProxyRes`.
2. Update to 2.0.1. See red squiggly lines. Be sad.

Expected behavior (be clear and concise)

No breaking changes in patch version changes.

What http-proxy-middleware configuration are you using?

N/A

What OS/version and node/version are you seeing the problem?

N/A

Additional context (optional)

No response

@ThomWright ThomWright added the bug label Aug 11, 2021
@artemtam
Copy link

Can confirm we have our types broken in 2.0.1. In 2.0.0 the onProxyReq definition is the following:

(proxyReq: http.ClientRequest, req: Request, res: Response) => void;

In 2.0.1 it is changed to:

(proxyReq: http.ClientRequest, req: http.IncomingMessage, res: http.ServerResponse, options: httpProxy.ServerOptions) => void;

It is definitely a breaking change, so it must have been a major version bump. Also, it is unclear if it is just a wrong type definition, or the real implementation of onProxyReq has changed?

@asself
Copy link

asself commented Sep 9, 2021

same issue,why minor version upgrade lead to break change?

@rcollette
Copy link

Further, objects that are appended to the Request type, such as Okta's OIDC middleware userContext, are not recognized with IncomingMessage. Granted, these things should be tacked on to locals, but... even req.Body is no longer recognized as a property of IncomingMessage.

I'm rolling back to 2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants