getCachedRequestURL method
HttpResponse?
getCachedRequestURL(
- HttpMethod method,
- String requestURL, {
- Credential? authorization,
- Map<
String, String?> ? queryParameters, - Object? body,
- String? contentType,
- String? accept,
Gets a request already in cache using httpClient and requestURL.
Implementation
HttpResponse? getCachedRequestURL(
HttpMethod method,
String requestURL, {
Credential? authorization,
Map<String, String?>? queryParameters,
Object? body,
String? contentType,
String? accept,
}) {
var cacheRequest = _CacheRequest(
method,
requestURL,
queryParameters,
body,
contentType,
accept,
authorization,
);
var cachedEntry = _cache[cacheRequest];
// An expired entry: not returned (as by [requestURL]).
var cachedResponse =
cachedEntry != null &&
cachedEntry.request.isValid(timeout.inMilliseconds)
? cachedEntry.response
: null;
if (cachedResponse != null) {
if (verbose) {
_log('Cached request: $method > $requestURL > $cachedResponse');
}
return cachedResponse;
}
return null;
}