aboutsummaryrefslogtreecommitdiff
path: root/src/net/http/httputil/reverseproxy_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/http/httputil/reverseproxy_test.go')
-rw-r--r--src/net/http/httputil/reverseproxy_test.go41
1 files changed, 32 insertions, 9 deletions
diff --git a/src/net/http/httputil/reverseproxy_test.go b/src/net/http/httputil/reverseproxy_test.go
index 588022c066..5caa206066 100644
--- a/src/net/http/httputil/reverseproxy_test.go
+++ b/src/net/http/httputil/reverseproxy_test.go
@@ -7,23 +7,23 @@
package httputil
import (
+ "bufio"
+ "bytes"
+ "errors"
+ "fmt"
+ "io"
"io/ioutil"
"log"
"net/http"
"net/http/httptest"
"net/url"
- "testing"
- "time"
+ "os"
"reflect"
- "io"
+ "strconv"
"strings"
- "bufio"
"sync"
- "strconv"
- "bytes"
- "errors"
- "fmt"
- "os"
+ "testing"
+ "time"
)
const fakeHopHeader = "X-Fake-Hop-Header-For-Test"
@@ -1078,3 +1078,26 @@ func TestUnannouncedTrailer(t *testing.T) {
}
}
+
+func TestSingleJoinSlash(t *testing.T) {
+ tests := []struct {
+ slasha string
+ slashb string
+ expected string
+ }{
+ {"https://www.google.com/", "/favicon.ico", "https://www.google.com/favicon.ico"},
+ {"https://www.google.com", "/favicon.ico", "https://www.google.com/favicon.ico"},
+ {"https://www.google.com", "favicon.ico", "https://www.google.com/favicon.ico"},
+ {"https://www.google.com", "", "https://www.google.com/"},
+ {"", "favicon.ico", "/favicon.ico"},
+ }
+ for _, tt := range tests {
+ if got := singleJoiningSlash(tt.slasha, tt.slashb); got != tt.expected {
+ t.Errorf("singleJoiningSlash(%s,%s) want %s got %s",
+ tt.slasha,
+ tt.slashb,
+ tt.expected,
+ got)
+ }
+ }
+}