示例#1
0
func TestHappyRead(t *testing.T) {
	// register the modules
	modprobe.Install("mod_mock", NewModMock)

	input := []byte(`
	{"id": "getping",
     "method": "GET",
     "enabled": true,
     "pattern": "/ping/:hola",
     "chain": [
  	    {"ref": "mod_mock", 
  	     "params": {
  	     	"optiona1": "a1", 
  	     	"optiona2": "a2"}},
	    {"ref": "mod_mock", 
	     "params": {
	     	"optiona1": "b1"}
	     }
	     ]
	}`)
	p, err := newProxyFromJson(input)
	assert.Nil(t, err)
	assert.Equal(t, p.GetId(), "getping")
	assert.Equal(t, p.GetMethod(), "GET")
	assert.Equal(t, p.IsEnabled(), true)
	assert.Equal(t, p.GetPattern(), "/ping/:hola")
	assert.Equal(t, len(p.GetChain().GetModules()), 2)

	modType := reflect.TypeOf(p.GetChain().GetModules()[0])

	fmt.Printf("All: %+v\n", modType)
	fmt.Printf("Name: %s\n", modType.Name())
	fmt.Printf("Pkg: %s\n", modType.PkgPath())

	fmt.Printf("Kind: %s\n", modType.Kind())
}
示例#2
0
文件: exec.go 项目: kapalhq/envoy
func init() {
	modprobe.Install("mod_exec", NewExec)
}
示例#3
0
文件: access.go 项目: kapalhq/envoy
func init() {
	modprobe.Install("mod_access", NewAccess)
}
示例#4
0
文件: rewrite.go 项目: kapalhq/envoy
func init() {
	modprobe.Install("mod_rewrite", NewRewrite)
}
示例#5
0
文件: http_lb.go 项目: kapalhq/envoy
func init() {
	modprobe.Install("mod_http_lb", NewHttpLoadbalancer)
}
示例#6
0
func init() {
	modprobe.Install("mod_basic_auth", NewBasicAuth)
}
示例#7
0
文件: docker.go 项目: kapalhq/envoy
func init() {
	modprobe.Install("mod_docker", NewDocker)
}