Wasn't reading body not that it's using FormValue for some reason. Moved body read up.

This commit is contained in:
Travis
2012-12-31 16:33:22 -08:00
parent 2a2cf3a3d6
commit dc27c6620f

View File

@@ -98,17 +98,17 @@ func ProxyFunc(w http.ResponseWriter, req *http.Request) {
func AddWorker(w http.ResponseWriter, req *http.Request) {
log.Println("AddWorker called!")
// get project id and token
projectId := req.FormValue("project_id")
token := req.FormValue("token")
fmt.Println("project_id:", projectId, "token:", token)
r2 := Route2{}
decoder := json.NewDecoder(req.Body)
decoder.Decode(&r2)
// todo: do we need to close body?
fmt.Println("DECODED:", r2)
// get project id and token
projectId := req.FormValue("project_id")
token := req.FormValue("token")
fmt.Println("project_id:", projectId, "token:", token)
// todo: routing table should be in mongo (or IronCache?) so all routers can update/read from it.
// todo: one cache entry per host domain
route := routingTable[r2.Host]