Skip to content

Commit 5d0d35d

Browse files
authored
Merge pull request #737 from StrongMonkey/fix-query-openapi
Fix: Fix query not added if there are multple entries
2 parents 9e47c39 + ab1768a commit 5d0d35d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pkg/openapi/run.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ func HandleAuths(req *http.Request, envMap map[string]string, infoSets [][]Secur
177177

178178
// We're using this info set, because no environment variables were missing.
179179
// Set up the request as needed.
180+
v := url.Values{}
180181
for _, info := range infoSet {
181182
envNames := maps.Values(info.getCredentialNamesAndEnvVars(req.URL.Hostname()))
182183
switch info.Type {
@@ -185,9 +186,7 @@ func HandleAuths(req *http.Request, envMap map[string]string, infoSets [][]Secur
185186
case "header":
186187
req.Header.Set(info.APIKeyName, envMap[envNames[0]])
187188
case "query":
188-
v := url.Values{}
189189
v.Add(info.APIKeyName, envMap[envNames[0]])
190-
req.URL.RawQuery = v.Encode()
191190
case "cookie":
192191
req.AddCookie(&http.Cookie{
193192
Name: info.APIKeyName,
@@ -203,6 +202,9 @@ func HandleAuths(req *http.Request, envMap map[string]string, infoSets [][]Secur
203202
}
204203
}
205204
}
205+
if len(v) > 0 {
206+
req.URL.RawQuery = v.Encode()
207+
}
206208
return nil
207209
}
208210

0 commit comments

Comments
 (0)