aboutsummaryrefslogtreecommitdiff
path: root/jobs/basejob.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2017-11-21 16:54:39 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2017-11-21 16:54:39 +0900
commitfed4b4fe965a9e2788055b602c7217cb298f5fce (patch)
tree55763111d9fe849a3373594e8faf0de9fb7c0470 /jobs/basejob.cpp
parent6fe34a3fc474c298a2df160343b9b3f09caffac2 (diff)
downloadlibquotient-fed4b4fe965a9e2788055b602c7217cb298f5fce.tar.gz
libquotient-fed4b4fe965a9e2788055b602c7217cb298f5fce.zip
Mitigate the mess with slashes between base URL and endpoint string
Closes #125
Diffstat (limited to 'jobs/basejob.cpp')
-rw-r--r--jobs/basejob.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/jobs/basejob.cpp b/jobs/basejob.cpp
index 20fb68f6..9d5c5ed6 100644
--- a/jobs/basejob.cpp
+++ b/jobs/basejob.cpp
@@ -137,7 +137,11 @@ void BaseJob::setRequestData(const BaseJob::Data& data)
void BaseJob::Private::sendRequest()
{
QUrl url = connection->baseUrl();
- url.setPath( url.path() + "/" + apiEndpoint );
+ QString path = url.path();
+ if (!path.endsWith('/') && !apiEndpoint.startsWith('/'))
+ path.push_back('/');
+
+ url.setPath( path + apiEndpoint );
url.setQuery(requestQuery);
QNetworkRequest req {url};
@@ -207,6 +211,7 @@ void BaseJob::gotReply()
BaseJob::Status BaseJob::checkReply(QNetworkReply* reply) const
{
+ qCDebug(d->logCat) << this << "returned from" << reply->url().toDisplayString();
if (reply->error() != QNetworkReply::NoError)
qCDebug(d->logCat) << this << "returned" << reply->error();
switch( reply->error() )