github.com/johnnyeven/libtools@v0.0.0-20191126065708-61829c1adf46/courier/transport_http/utils_test.go (about) 1 package transport_http 2 3 import ( 4 "testing" 5 6 "github.com/julienschmidt/httprouter" 7 "github.com/stretchr/testify/assert" 8 ) 9 10 func TestGetParams(t *testing.T) { 11 tt := assert.New(t) 12 13 { 14 _, err := GetParams("/:a/:b/:c", "/a/c") 15 tt.NotNil(err) 16 } 17 18 { 19 params, err := GetParams("/:a/:b/:c", "/a/b/c") 20 tt.Nil(err) 21 tt.Equal(httprouter.Params{ 22 { 23 Key: "a", 24 Value: "a", 25 }, 26 { 27 Key: "b", 28 Value: "b", 29 }, 30 { 31 Key: "c", 32 Value: "c", 33 }, 34 }, params) 35 } 36 } 37 38 func TestGetClientIP(t *testing.T) { 39 }