In Android, I am using Fuel, a Kotlin library, to fetch a JSON file. Right now, my code looks like this (url is a variable of type string):
url.httpGet().responseJson { _, _, result ->
when(result) {
is Result.Failure -> {
//Do Stuff
}
is Result.Success -> {
//Do Stuff
}
}
}
However, I'd like to fetch an uncached version of the JSON file located at the url
.
I read this post: fetch(), how do you make a non-cached request? and it seems like I have to add the headers "pragma: no-cache" and "cache-control: no-cache" to my request. How can I do that?
Also - is there a way for me to verify that those two headers are being sent as part of my request, for debugging purposes?
While my code sample is in Kotlin, I'm fine with answers in Java.