Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cmd/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,11 @@ func NewAPIRequest(r *Request, api string, args []string, isAsync bool) (map[str
func executeRequest(r *Request, requestURL string, params url.Values) (*http.Response, error) {
config.SetupContext(r.Config)
if params.Has("password") || params.Has("userdata") || r.Config.Core.PostRequest {
requestURL = fmt.Sprintf("%s", r.Config.ActiveProfile.URL)
requestURL = r.Config.ActiveProfile.URL
config.Debug("Using HTTP POST for the request: ", requestURL)
return r.Client().PostForm(requestURL, params)
}
config.Debug("Using HTTP GET for the request: ", requestURL)
req, _ := http.NewRequestWithContext(*r.Config.Context, "GET", requestURL, nil)
return r.Client().Do(req)
}
1 change: 1 addition & 0 deletions cmd/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func init() {
"verifycert": {"true", "false"},
"debug": {"true", "false"},
"autocomplete": {"true", "false"},
"postrequest": {"true", "false"},
},
Handle: func(r *Request) error {
if len(r.Args) < 1 {
Expand Down
4 changes: 3 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ type Core struct {
VerifyCert bool `ini:"verifycert"`
ProfileName string `ini:"profile"`
AutoComplete bool `ini:"autocomplete"`
PostRequest bool `ini:postrequest`
PostRequest bool `ini:"postrequest"`
}

// Config describes CLI config file and default options
Expand Down Expand Up @@ -401,6 +401,8 @@ func (c *Config) UpdateConfig(key string, value string, update bool) {
}
case "autocomplete":
c.Core.AutoComplete = value == "true"
case "postrequest":
c.Core.PostRequest = value == "true"
default:
fmt.Println("Invalid option provided:", key)
return
Expand Down