[JAVA] use query parameter apikey if present (#19334)

* Fix #16362

* Update samples

* Undo formatting changes

* Revert whitespace changes in samples

* make it work

---------

Co-authored-by: Jason Boileau <jason@boileau.dk>
Co-authored-by: Jason Boileau <spraot@users.noreply.github.com>
This commit is contained in:
martin-mfg
2024-08-14 09:02:37 +02:00
committed by GitHub
parent d55525fbc4
commit 58dd0305ce
14 changed files with 70 additions and 98 deletions

View File

@@ -1267,10 +1267,6 @@ public class ApiClient {
* @throws org.openapitools.client.ApiException If fail to serialize the request body object
*/
public Request buildRequest(String baseUrl, String path, String method, List<Pair> queryParams, List<Pair> collectionQueryParams, Object body, Map<String, String> headerParams, Map<String, String> cookieParams, Map<String, Object> formParams, String[] authNames, ApiCallback callback) throws ApiException {
// aggregate queryParams (non-collection) and collectionQueryParams into allQueryParams
List<Pair> allQueryParams = new ArrayList<Pair>(queryParams);
allQueryParams.addAll(collectionQueryParams);
final String url = buildUrl(baseUrl, path, queryParams, collectionQueryParams);
// prepare HTTP request body
@@ -1298,10 +1294,12 @@ public class ApiClient {
reqBody = serialize(body, contentType);
}
// update parameters with authentication settings
updateParamsForAuth(authNames, allQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url));
List<Pair> updatedQueryParams = new ArrayList<>(queryParams);
final Request.Builder reqBuilder = new Request.Builder().url(url);
// update parameters with authentication settings
updateParamsForAuth(authNames, updatedQueryParams, headerParams, cookieParams, requestBodyToString(reqBody), method, URI.create(url));
final Request.Builder reqBuilder = new Request.Builder().url(buildUrl(baseUrl, path, updatedQueryParams, collectionQueryParams));
processHeaderParams(headerParams, reqBuilder);
processCookieParams(cookieParams, reqBuilder);