Review changes for HTTP paths

This reviews the code and fixes up suggestions made by team for
the HTTP paths PR #789.

- Removed feature-flag (this is backwards-compatible, so I see
no value in adding the flag)
- There was a URL transform happening for calls proxied to the
back end, I changed this for the nil-transform - i.e. it does not
change anything in the URL
- Introduced variables to describe the regex indicies used in
the URL trimming.

Tested with Docker Swarm with a ruby-microservice, with
system calls and with function calls using the UI.

Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
This commit is contained in:
Alex Ellis (VMware)
2018-08-24 10:03:26 +01:00
committed by Alex Ellis
parent b1846b842c
commit 2f98ca8802
5 changed files with 31 additions and 34 deletions

View File

@ -78,7 +78,7 @@ func Test_buildUpstreamRequest_HasHostHeaderWhenSet(t *testing.T) {
t.Fatal(err)
}
upstream := buildUpstreamRequest(request, "/")
upstream := buildUpstreamRequest(request, "/", "/")
if request.Host != upstream.Host {
t.Errorf("Host - want: %s, got: %s", request.Host, upstream.Host)
@ -95,7 +95,7 @@ func Test_buildUpstreamRequest_HostHeader_Empty_WhenNotSet(t *testing.T) {
t.Fatal(err)
}
upstream := buildUpstreamRequest(request, "/")
upstream := buildUpstreamRequest(request, "/", "/")
if request.Host != upstream.Host {
t.Errorf("Host - want: %s, got: %s", request.Host, upstream.Host)