Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RequestCmd = &cli.Command{ Name: "requests", Aliases: []string{"req"}, Usage: "A set of commands to work with requests", Subcommands: []*cli.Command{ requestListCmd, }, }
View Source
var RunCmd = &cli.Command{ Name: "run", Aliases: []string{"r"}, Usage: "Execute HTTP requests", ArgsUsage: "GROUP REQUEST", Flags: []cli.Flag{ &cli.BoolFlag{Name: "silent", Aliases: []string{"s"}}, &cli.StringSliceFlag{ Name: "path-param", Usage: "params for path interpolation - key=value", Aliases: []string{"p"}, }, }, Action: func(cCtx *cli.Context) error { group := cCtx.Args().Get(0) name := cCtx.Args().Get(1) if group == "" || name == "" { fmt.Fprintf(cCtx.App.Writer, "No group or request specified\n\n") cli.ShowSubcommandHelp(cCtx) return nil } err := setPathParams(cCtx) if err != nil { return err } request, err := core.FetchRequestConfigByName(group, name) if err != nil { return err } client := core.BuildClient(request.HTTPConfig) req, err := core.BuildHTTPRequest(request.HTTPConfig) if err != nil { log.Println("Failed to make request", err) return err } printRequest(cCtx, req) execution, err := core.PerformRequest(req, client) if err != nil { log.Println("client: could not create request:", err) return err } printResponse(cCtx, execution) if execution.Response.StatusCode >= 400 { return cli.Exit("", 1) } return nil }, }
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.