Commit 4911dc06 authored by Brian Tiger Chow's avatar Brian Tiger Chow Committed by Juan Batiz-Benet

refactor(commands) swap argument order to match Http(w, r) idiom

parent b1bf60b8
......@@ -12,7 +12,7 @@ var log = u.Logger("command")
// Function is the type of function that Commands use.
// It reads from the Request, and writes results to the Response.
type Function func(Request, Response)
type Function func(Response, Request)
// Formatter is a function that takes in a Response, and returns a human-readable string
// (or an error on failure)
......@@ -63,7 +63,7 @@ func (c *Command) Call(req Request) Response {
return res
}
cmd.Run(req, res)
cmd.Run(res, req)
return res
}
......
......@@ -8,7 +8,7 @@ func TestOptionValidation(t *testing.T) {
Option{[]string{"b", "beep"}, Int},
Option{[]string{"B", "boop"}, String},
},
Run: func(req Request, res Response) {},
Run: func(res Response, req Request) {},
}
req := NewEmptyRequest()
......@@ -79,7 +79,7 @@ func TestOptionValidation(t *testing.T) {
}
func TestRegistration(t *testing.T) {
noop := func(req Request, res Response) {}
noop := func(res Response, req Request) {}
cmdA := &Command{
Options: []Option{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment