romana / core

Romana core components - Micro services written in Go.
Apache License 2.0
47 stars 11 forks source link

New handler in agent (for Greg) #31

Closed flashvoid closed 7 years ago

flashvoid commented 8 years ago

Hi Greg,

Following on discussion yearly today. What i want to do is to introduce new routes. I'm trying to start from duplicating one existing route and assign different handler to it.

https://github.com/romana/core/blob/feature/k8s-handler/agent/agent.go#L64

however, this fails. Now, are we have special, per-route, logic in middleware or am i doing something wrong?

root@ip-192-168-0-211:/home/ubuntu# curl -XPOST -d '{ "interface_name": "veth0-25955", "mac_address": "de:ad:be:ef:00:00", "ip_address" : "10.1.33.5"  }' http://localhost:9604
curl: (52) Empty reply from server
2016/01/25 23:43:28 Marshaler {} for application/x-www-form-urlencoded
2016/01/25 23:43:28 Entering formMarshaller.Unmarshal()
[negroni] http: panic serving 127.0.0.1:39179: runtime error: index out of range
goroutine 13 [running]:
net/http.(*conn).serve.func1(0xc8200a2420, 0x7efe5cf658b8, 0xc82002a100)
        /usr/local/go/src/net/http/server.go:1287 +0xb5
github.com/romana/core/common.formMarshaller.Unmarshal(0xc8200d4400, 0x64, 0x200, 0x6b6720, 0xc82002a108, 0x0, 0x0)
        /home/void/go/src/github.com/romana/core/common/middleware.go:347 +0x1587
github.com/romana/core/common.(*formMarshaller).Unmarshal(0x9b9ec0, 0xc8200d4400, 0x64, 0x200, 0x6b6720, 0xc82002a108, 0x0, 0x0)
        <autogenerated>:6 +0xcb
github.com/romana/core/common.UnmarshallerMiddleware.ServeHTTP(0x7efe5cf67b20, 0xc82004fc00, 0xc8200889a0, 0xc8200d2ba0)
        /home/void/go/src/github.com/romana/core/common/middleware.go:496 +0x5ca
github.com/romana/core/common.(*UnmarshallerMiddleware).ServeHTTP(0x9b9ec0, 0x7efe5cf67b20, 0xc82004fc00, 0xc8200889a0, 0xc8200d2ba0)
        <autogenerated>:10 +0xb5