From 1a3fa80fdb59a3fa72af73a6d21454591a406618 Mon Sep 17 00:00:00 2001 From: Jan Winkelmann Date: Mon, 14 Nov 2016 22:32:41 +0100 Subject: [PATCH] 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 --- commands/command.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/commands/command.go b/commands/command.go index bec6d850c..700332acc 100644 --- a/commands/command.go +++ b/commands/command.go @@ -52,9 +52,14 @@ type HelpText struct { // Command is a runnable command, with input arguments and options (flags). // It can also have Subcommands, to group units of work into sets. type Command struct { - Options []Option - Arguments []Argument - PreRun func(req Request) error + Options []Option + Arguments []Argument + PreRun func(req Request) error + + // Run is the function that processes the request to generate a response. + // Note that when executing the command over the HTTP API you can only read + // after writing when using multipart requests. The request body will not be + // available for reading after the HTTP connection has been written to. Run Function PostRun Function Marshalers map[EncodingType]Marshaler