aboutsummaryrefslogtreecommitdiff
path: root/lib/jobs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/jobs')
-rw-r--r--lib/jobs/basejob.cpp24
-rw-r--r--lib/jobs/basejob.h4
2 files changed, 13 insertions, 15 deletions
diff --git a/lib/jobs/basejob.cpp b/lib/jobs/basejob.cpp
index 6346db9d..85066024 100644
--- a/lib/jobs/basejob.cpp
+++ b/lib/jobs/basejob.cpp
@@ -194,12 +194,12 @@ QUrl BaseJob::requestUrl() const { return d->reply ? d->reply->url() : QUrl(); }
bool BaseJob::isBackground() const { return d->inBackground; }
-const QString& BaseJob::apiEndpoint() const { return d->apiEndpoint; }
+//const QString& BaseJob::apiEndpoint() const { return d->apiUrl.path(); }
-void BaseJob::setApiEndpoint(const QString& apiEndpoint)
-{
- d->apiEndpoint = apiEndpoint;
-}
+//void BaseJob::setApiEndpoint(const QString& apiEndpoint)
+//{
+// d->apiEndpoint = apiEndpoint;
+//}
const BaseJob::headers_t& BaseJob::requestHeaders() const
{
@@ -217,7 +217,7 @@ void BaseJob::setRequestHeaders(const BaseJob::headers_t& headers)
d->requestHeaders = headers;
}
-const QUrlQuery& BaseJob::query() const { return d->requestQuery; }
+QUrlQuery BaseJob::query() const { return d->requestQuery; }
void BaseJob::setRequestQuery(const QUrlQuery& query)
{
@@ -262,14 +262,10 @@ QNetworkReply* BaseJob::reply() { return d->reply.data(); }
QUrl BaseJob::makeRequestUrl(QUrl baseUrl, const QString& path,
const QUrlQuery& query)
{
- auto pathBase = baseUrl.path();
- // QUrl::adjusted(QUrl::StripTrailingSlashes) doesn't help with root '/'
- while (pathBase.endsWith('/'))
- pathBase.chop(1);
- if (!path.startsWith('/')) // Normally API files do start with '/'
- pathBase.push_back('/'); // so this shouldn't be needed these days
-
- baseUrl.setPath(pathBase + path, QUrl::TolerantMode);
+ // Make sure the added path is relative even if it's not (the official
+ // API definitions have the leading slash though it's not really correct).
+ baseUrl = baseUrl.resolved(
+ QUrl(path.mid(path.startsWith('/')), QUrl::TolerantMode));
baseUrl.setQuery(query);
return baseUrl;
}
diff --git a/lib/jobs/basejob.h b/lib/jobs/basejob.h
index 29443c53..663c121c 100644
--- a/lib/jobs/basejob.h
+++ b/lib/jobs/basejob.h
@@ -325,13 +325,15 @@ Q_SIGNALS:
protected:
using headers_t = QHash<QByteArray, QByteArray>;
+ Q_DECL_DEPRECATED_X("Deprecated due to being unused")
const QString& apiEndpoint() const;
+ Q_DECL_DEPRECATED_X("Deprecated due to being unused")
void setApiEndpoint(const QString& apiEndpoint);
const headers_t& requestHeaders() const;
void setRequestHeader(const headers_t::key_type& headerName,
const headers_t::mapped_type& headerValue);
void setRequestHeaders(const headers_t& headers);
- const QUrlQuery& query() const;
+ QUrlQuery query() const;
void setRequestQuery(const QUrlQuery& query);
const RequestData& requestData() const;
void setRequestData(RequestData&& data);