1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-19 18:05:32 +08:00

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

This commit is contained in:
Brian Tiger Chow
2014-10-29 01:42:52 -07:00
committed by Juan Batiz-Benet
parent b1bf60b877
commit 4911dc069a
2 changed files with 4 additions and 4 deletions

View File

@ -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
}

View File

@ -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{