Skip to content

Fix: Fix query not added if there are multple entries #737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 7, 2024
Merged
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
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