diff --git a/src/client.go b/src/client.go index 95c8e3e..1ef5f01 100644 --- a/src/client.go +++ b/src/client.go @@ -13,9 +13,9 @@ ) type ClientCommand struct { - Headers []string `long:"header" description:"A header to add to request in the form name:value. Use multiple times for multiple headers."` - Method string `short:"m" long:"method" description:"HTTP method for request" default:"GET"` URL string `short:"u" long:"url" description:"The URL to send the request to" required:"true"` + Headers []string `short:"H" long:"header" description:"A header to add to request in the form name:value. Use multiple times for multiple headers."` + Method string `short:"m" long:"method" choice:"GET" choice:"POST" choice:"PUT" choice:"DELETE" choice:"PATCH" choice:"HEAD" choice:"OPTIONS" description:"HTTP method for request" default:"GET"` Body string `short:"b" long:"body" description:"Request body to send"` } @@ -50,17 +50,8 @@ if response, err := client.Do(request); err != nil { fmt.Println("Could not connect to server") } else { - defer response.Body.Close() - - // show response - if globalOptions.BodiesOnly { - showResponseBody(response) - } else if globalOptions.HeadersOnly { - showResponseHeaders(response) - } else { - showEntireResponse(response) - } + showResponse(response) } }