fix search in locations, fix proxying URI in http

This commit is contained in:
Maxim Merzhanov committed 2020-04-24 19:12:31 +03:00
1 parent f0b8407479
commit 896dd36025
7 files changed
+126 -82

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
package proxy
import (
"testing"
)
func Test_getPathWithoutPrefix(t *testing.T) {
type args struct {
path string
prefix string
}
tests := []struct {
name string
args args
want string
}{
{name: "#1", args: args{
path: "/api/some/11/22",
prefix: "/api/some",
}, want: "11/22"},
{name: "#2", args: args{
path: "/api/service/group/method",
prefix: "/api",
}, want: "service/group/method"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := getPathWithoutPrefix(tt.args.path, tt.args.prefix); got != tt.want {
t.Errorf("getPathWithoutPrefix() = %v, want %v", got, tt.want)
}
})
}
}