Skip to content

Commit 4ee0ee9

Browse files
authored
Merge pull request #26 from thc202/apikey-param-old
Send API key even if there are no parameters
2 parents ccc93c5 + 01668db commit 4ee0ee9

File tree

1 file changed

+7
-0
lines changed
  • subprojects/zap-clientapi/src/main/java/org/zaproxy/clientapi/core

1 file changed

+7
-0
lines changed

subprojects/zap-clientapi/src/main/java/org/zaproxy/clientapi/core/ClientApi.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,13 @@ private HttpRequest buildZapRequest(
398398
}
399399
sb.append('&');
400400
}
401+
} else if (apiKey != null && !apiKey.isEmpty()) {
402+
// Send the API key even if there are no parameters,
403+
// older ZAP versions might need it as (query) parameter.
404+
sb.append('?');
405+
sb.append(encodeQueryParam(ZAP_API_KEY_PARAM));
406+
sb.append('=');
407+
sb.append(encodeQueryParam(apiKey));
401408
}
402409

403410
HttpRequest request = new HttpRequest(new URL(sb.toString()));

0 commit comments

Comments
 (0)