http-proxy-middleware icon indicating copy to clipboard operation
http-proxy-middleware copied to clipboard

http-proxy-middleware.ts Return promise to wait end of connection

Open desfun opened this issue 2 years ago • 0 comments

It allows koajs handle http-proxy-middleware, awaiting end of transaction from proxy, if you don't handle it, response will be emitted before end of proxy request.

Description

Allow handle propperly end of remote connection before emit response to client.

Motivation and Context

Koajs compability

How has this been tested?

const app = new koa(); app.use(async ({req,res},next)=>{ const Proxy = createProxyMiddleware(options); await Proxy(req,res,next); }});

Types of changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [X] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • [ ] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.

desfun avatar Jan 29 '23 15:01 desfun