vagusX / koa-proxies

a koa@2.x+ proxy middleware
https://vagusx.github.io/koa-proxies/
MIT License
161 stars 44 forks source link

Add rewirte function parameter to dynamically change path #35

Closed BenukEl closed 5 years ago

BenukEl commented 5 years ago

Hello,

I would like to dynamically change the path of my proxy according to the context state. After change, I can call proxy like this : const proxy('/demo', { target: 'http://localhost:8080/', changeOrigin: true, rewrite: (path, ctx) => path.replace(/^(.*\?.*)$/,$1&USERID=${ctx.state.user.username}), logs: true });

codecov[bot] commented 5 years ago

Codecov Report

Merging #35 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master     #35   +/-   ##
======================================
  Coverage    92.3%   92.3%           
======================================
  Files           1       1           
  Lines          39      39           
  Branches        6       6           
======================================
  Hits           36      36           
  Misses          3       3
Impacted Files Coverage Δ
index.js 92.3% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 2d81f45...cc1c840. Read the comment docs.

codecov[bot] commented 5 years ago

Codecov Report

Merging #35 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master     #35   +/-   ##
======================================
  Coverage    92.3%   92.3%           
======================================
  Files           1       1           
  Lines          39      39           
  Branches        6       6           
======================================
  Hits           36      36           
  Misses          3       3
Impacted Files Coverage Δ
index.js 92.3% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 2d81f45...cc1c840. Read the comment docs.

vagusX commented 5 years ago

:tada: This PR is included in version 0.9.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: