0x1306e6d / tollgate

An API gateway for your microservice.
MIT License
6 stars 1 forks source link

Allow to transform `HttpRequest` or `HttpResponse` #140

Closed 0x1306e6d closed 3 years ago

0x1306e6d commented 3 years ago

Add mapRequest and mapResponse methods to UpstreamBuilder. They allow users to transform HttpRequest or HttpResponse directly. It would be useful if a user want to customize something that Tollgate doesn't support yet.

Existing disallowRequestHeaders and disallowResponseHeaders now uses mapRequest and mapResponse respectively. Implementation of disallow is extracted from DefaultUpstream to independent Function implementation, DisallowRequestHeadersFunction and DisallowResponseHeadersFunction. Because both functions accept Predicate to test which headers to disallow, we can provide more easier way to disallow headers in future.

codecov[bot] commented 3 years ago

Codecov Report

Merging #140 (d460b49) into master (8e34acd) will increase coverage by 1.15%. The diff coverage is 95.55%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #140      +/-   ##
============================================
+ Coverage     67.51%   68.66%   +1.15%     
- Complexity      127      137      +10     
============================================
  Files            25       27       +2     
  Lines           434      450      +16     
  Branches         28       23       -5     
============================================
+ Hits            293      309      +16     
  Misses          116      116              
  Partials         25       25              
Impacted Files Coverage Δ
...llgate/gateway/DisallowRequestHeadersFunction.java 91.66% <91.66%> (ø)
...lgate/gateway/DisallowResponseHeadersFunction.java 91.66% <91.66%> (ø)
...a/dev/gihwan/tollgate/gateway/DefaultUpstream.java 100.00% <100.00%> (ø)
...a/dev/gihwan/tollgate/gateway/UpstreamBuilder.java 61.11% <100.00%> (+11.11%) :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 8e34acd...d460b49. Read the comment docs.