Skip to content

Commit

Permalink
Merge pull request #737 from StrongMonkey/fix-query-openapi
Browse files Browse the repository at this point in the history
Fix: Fix query not added if there are multple entries
  • Loading branch information
StrongMonkey authored Aug 7, 2024
2 parents 9e47c39 + ab1768a commit 5d0d35d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/openapi/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ func HandleAuths(req *http.Request, envMap map[string]string, infoSets [][]Secur

// We're using this info set, because no environment variables were missing.
// Set up the request as needed.
v := url.Values{}
for _, info := range infoSet {
envNames := maps.Values(info.getCredentialNamesAndEnvVars(req.URL.Hostname()))
switch info.Type {
Expand All @@ -185,9 +186,7 @@ func HandleAuths(req *http.Request, envMap map[string]string, infoSets [][]Secur
case "header":
req.Header.Set(info.APIKeyName, envMap[envNames[0]])
case "query":
v := url.Values{}
v.Add(info.APIKeyName, envMap[envNames[0]])
req.URL.RawQuery = v.Encode()
case "cookie":
req.AddCookie(&http.Cookie{
Name: info.APIKeyName,
Expand All @@ -203,6 +202,9 @@ func HandleAuths(req *http.Request, envMap map[string]string, infoSets [][]Secur
}
}
}
if len(v) > 0 {
req.URL.RawQuery = v.Encode()
}
return nil
}

Expand Down

0 comments on commit 5d0d35d

Please sign in to comment.