Documentation ¶
Index ¶
- type Command
- type Option
- func WithCompression() Option
- func WithDoubleQuotes() Option
- func WithFollowRedirects() Option
- func WithInsecure() Option
- func WithLongForm() Option
- func WithMultiLine() Option
- func WithPowerShellMultiLine() Option
- func WithRequestTimeout(seconds int) Option
- func WithSilent() Option
- func WithWindowsMultiLine() Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
A Command represents a cURL command based on an HTTP request.
Returned by NewFromRequest, a Command expects a pointer to http.Request as input. It generates a cURL command string, which by default uses a single line command, short form options, and single quote escaping.
func NewFromRequest ¶
NewFromRequest returns a new Command that reads from r. If the request has an invalid URL, NewFromRequest returns an error. If NewFromRequest can't read the request body, it returns an error.
type Option ¶
type Option func(curling *Command)
func WithCompression ¶
func WithCompression() Option
WithCompression enables the option --compressed.
func WithDoubleQuotes ¶ added in v1.0.4
func WithDoubleQuotes() Option
WithDoubleQuotes enables escaping using double quotes.
func WithFollowRedirects ¶
func WithFollowRedirects() Option
WithFollowRedirects enables the option -L, --location.
func WithLongForm ¶
func WithLongForm() Option
WithLongForm enables the long form for cURL options. Example: --header instead of -H.
func WithMultiLine ¶
func WithMultiLine() Option
WithMultiLine splits the command across multiple lines. The default line continuation character is backslash.
func WithPowerShellMultiLine ¶
func WithPowerShellMultiLine() Option
WithPowerShellMultiLine splits the command across multiple lines. The line continuation character is backtick.
func WithRequestTimeout ¶ added in v1.1.0
WithRequestTimeout enables the option -m, --max-time. It sets the number of seconds the request should wait for a response before timing out. Negative value seconds will be silently ignored.
func WithSilent ¶ added in v1.0.3
func WithSilent() Option
WithSilent enables the option -s, --silent.
func WithWindowsMultiLine ¶
func WithWindowsMultiLine() Option
WithWindowsMultiLine splits the command across multiple lines. The line continuation character is caret.