Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • N node-http-proxy
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 482
    • Issues 482
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 102
    • Merge requests 102
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • http ... PARTY!
  • node-http-proxy
  • Merge requests
  • !1407

feat onProxyReqWs async handler

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Administrator requested to merge github/fork/LiranBri/master into master Dec 16, 2019
  • Overview 5
  • Commits 8
  • Pipelines 1
  • Changes 3

Created by: LiranBri

Following issues https://github.com/http-party/node-http-proxy/issues/490 and https://github.com/http-party/node-http-proxy/issues/1403, currently the library does not support async handler for the proxyReqWs event for modifying the request before proxying it forward.

This suggested PR solved the problem, without breaking backward compatibility, by introducing a new argument asyncContext which is used as follows:


onProxyReqWs: (proxyReq, req, socket, options, head, asyncContext) =>
      asyncContext(async () => {
        // code ...
        const result = await anyAsyncOperation()
        // code ...
        proxyReq.setHeader('key', result)
      }),
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/LiranBri/master