-
Notifications
You must be signed in to change notification settings - Fork 876
Description
Checks
- I understand project setup issues should be asked on StackOverflow or in GitHub Discussions.
- I updated to latest
http-proxy-middleware.
Describe the bug (be clear and concise)
TS compilation error occurs with compatible response & reply primitives.
I expect a type signature from createProxyMiddleware to yield: (req: IncomingMessage, res: http.ServerResponse, next?: ...) => void. However, the returned handler is explicitly coupled to express: (req: expresscore.Request, res: expresscore.Response), etc.
This is invalid.
When my server tries to then:
server.use((req, res, next) => myProxyMiddleware(req,res,next))`i get a compilation error, because i'm using raw node interfaces (legit works!), but createProxyMiddleware demands express.js handlers.
Step-by-step reproduction instructions
TypeScript concern only
1. create a typescript project
2. install a non-express server, such as fastify & middie
3. try passing a `req: IncomingMessage` and `res: http.ServerResponse` into a `createProxyMiddleware(...)(req, res)`
4. observe compilation errorExpected behavior (be clear and concise)
No compilation error
How is http-proxy-middleware used in your project?
top level dependencyWhat http-proxy-middleware configuration are you using?
programmatic use.What OS/version and node/version are you seeing the problem?
n/aAdditional context (optional)
n/a
Metadata
Metadata
Assignees
Labels
No labels