Closed mgrubent closed 3 years ago
Unirest.primaryInstance().config().cacheResponses(false);
also appears to have no effect.
The following does seem to be a workaround, though it seems heavy-weight
UnirestInstance instance1 = Unirest.spawnInstance();
instance1.config().cacheResponses(false);
HttpResponse<JsonNode> response1 = instance1.get(stateUrl).queryString(queryStrings).asJson();
HttpResponse<JsonNode> response2 = Unirest.get(stateUrl).queryString(queryStrings).asJson();
There are extensive tests showing the cache NOT enabled. are you sure you don't have something else going on? Is there some process somewhere else setting it to true on the instance. There is no CacheManger by default, so I assume some other process is enabling it on the instance.
I added some tests explicitly with json:
Yep, there was indeed a lurking call to Unirest.config().reset()
.
Thanks for the quick response Ryan, I'll close this issue since I think this issue is specific to my usage of Unirest
.
Describe the bug
Unirest.get(url).queryString(queryStrings).asJson()
appears to return a cached response, even when preceded byUnirest.config().cacheResponses(false)
To Reproduce Steps to reproduce the behavior:
If, for instance,
OkHttpClient
is used instead, the correct and expected different responses are obtained.Expected behavior After the world changes, the body of the response returned by
Unirest.get
should changeScreenshots N/A
Environmental Data:
Additional context N/A