Commit 122f59d0 authored by Dan Leinir Turthra Jensen's avatar Dan Leinir Turthra Jensen 🌈 Committed by Aleix Pol Gonzalez
Browse files

Add a granular cache preference thing to attica-kde

This allows us to explicitly add cache preference to specific calls.
Usually attica calls want to be very current, but in some cases we can
assume things aren't going to change often (such as the categories
call), and we can just use the cached version for those calls.
parent 89751cb7
......@@ -125,8 +125,19 @@ QNetworkRequest KdePlatformDependent::addOAuthToRequest(const QNetworkRequest &r
const QString bearer = bearer_format.arg(token);
notConstReq.setRawHeader("Authorization", bearer.toUtf8());
notConstReq.setAttribute(QNetworkRequest::Http2AllowedAttribute, true);
// Add cache preference in a granular fashion (we will almost certainly want more of these, but...)
static const QList<QString> preferCacheEndpoints{
for (const QString &endpoint : preferCacheEndpoints) {
if (notConstReq.url().endsWith()) {
notConstReq.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache);
return notConstReq;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment