Skip to content

Commit 9aa57e6

Browse files
author
Kevin Li
committed
Changing executeAPI to utilize POST request
1 parent 5b36954 commit 9aa57e6

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

apirunner/apirunner.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,14 @@ func saveData(apiURL string, count float64, minTime float64, maxTime float64, av
253253

254254
func executeAPI(apiURL string, params url.Values) (float64, float64, bool) {
255255
// Send the API request and calculate the time
256-
apiURL = fmt.Sprintf("%s?%s", apiURL, params.Encode())
256+
data := strings.NewReader(params.Encode())
257257
log.Infof("Running the API %s", apiURL)
258258
start := time.Now()
259-
resp, err := http.Get(apiURL)
259+
resp, err := http.Post(
260+
apiURL,
261+
"application/x-www-form-urlencoded",
262+
data,
263+
)
260264
APIscount++
261265
if err != nil {
262266
log.Infof("Error sending API request: %s with error %s\n", apiURL, err)

0 commit comments

Comments
 (0)