Skip to content

Commit e27ca12

Browse files
committed
Explicitly disable HTTP cache in ClientApi
Change the ClientApi to disable the HTTP cache, while the API responses shouldn't be cached it seems they were, sometimes, which broke some use cases (e.g. poll the status of a scan). Related to zaproxy/zaproxy#4462 - ZAP Jenkins plugin does not obtain latest spider status
1 parent 9481cd7 commit e27ca12

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Summary of the changes done in each version.
44

55
## 1.6.0 (Not yet released)
66

7+
### Changes
8+
9+
- Explicitly disable HTTP caching, to always obtain a fresh response from ZAP.
710

811
## 1.5.0 (2017-11-30)
912

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ private Document callApiDom(
351351

352352
private InputStream getConnectionInputStream(HttpRequest request) throws IOException {
353353
HttpURLConnection uc = (HttpURLConnection) request.getRequestUri().openConnection(proxy);
354+
uc.setUseCaches(false);
354355
for (Entry<String, String> header : request.getHeaders().entrySet()) {
355356
uc.setRequestProperty(header.getKey(), header.getValue());
356357
}

0 commit comments

Comments
 (0)