@cryptotaxi247 / kubo / commits / 1a3fa80fd

Add docs for `"commands".Command.Run`

To clarify that if you want to access the request body after writing need to use multipart requests. License: MIT Signed-off-by: Jan Winkelmann <j-winkelmann@tuhh.de>

Jan Winkelmann committed Nov 14, 2016 at 22:32 UTC 1a3fa80fdb59a3fa72af73a6d21454591a406618
1 file changed +8 -3
commands/command.go
+8 -3
@@ -52,9 +52,14 @@ type HelpText struct {
52 // Command is a runnable command, with input arguments and options (flags).
53 // It can also have Subcommands, to group units of work into sets.
54 type Command struct {
55 - Options []Option
56 - Arguments []Argument
57 - PreRun func(req Request) error
55 + Options []Option
56 + Arguments []Argument
57 + PreRun func(req Request) error
58 +
59 + // Run is the function that processes the request to generate a response.
60 + // Note that when executing the command over the HTTP API you can only read
61 + // after writing when using multipart requests. The request body will not be
62 + // available for reading after the HTTP connection has been written to.
63 Run Function
64 PostRun Function
65 Marshalers map[EncodingType]Marshaler