Changeset View
Changeset View
Standalone View
Standalone View
src/core/deletejob.cpp
Show All 16 Lines | |||||
17 | * GNU Lesser General Public License for more details. | 17 | * GNU Lesser General Public License for more details. | ||
18 | * | 18 | * | ||
19 | * You should have received a copy of the GNU Lesser General Public | 19 | * You should have received a copy of the GNU Lesser General Public | ||
20 | * License along with this library. If not, see <https://www.gnu.org/licenses/>. | 20 | * License along with this library. If not, see <https://www.gnu.org/licenses/>. | ||
21 | */ | 21 | */ | ||
22 | 22 | | |||
23 | #include "deletejob.h" | 23 | #include "deletejob.h" | ||
24 | 24 | | |||
25 | #include <QUrlQuery> | ||||
25 | #include <QNetworkAccessManager> | 26 | #include <QNetworkAccessManager> | ||
26 | #include <QNetworkRequest> | 27 | #include <QNetworkRequest> | ||
27 | 28 | | |||
28 | using namespace KGAPI2; | 29 | using namespace KGAPI2; | ||
29 | 30 | | |||
30 | class Q_DECL_HIDDEN DeleteJob::Private | 31 | class Q_DECL_HIDDEN DeleteJob::Private | ||
31 | { | 32 | { | ||
32 | }; | 33 | }; | ||
Show All 20 Lines | 53 | { | |||
53 | Q_UNUSED(data) | 54 | Q_UNUSED(data) | ||
54 | Q_UNUSED(contentType) | 55 | Q_UNUSED(contentType) | ||
55 | 56 | | |||
56 | QNetworkRequest r = request; | 57 | QNetworkRequest r = request; | ||
57 | if (!r.hasRawHeader("If-Match")) { | 58 | if (!r.hasRawHeader("If-Match")) { | ||
58 | r.setRawHeader("If-Match", "*"); | 59 | r.setRawHeader("If-Match", "*"); | ||
59 | } | 60 | } | ||
60 | 61 | | |||
62 | // Delete requests have no response body so there isn't anything to pretty print | ||||
63 | QUrl cleanedUrl = r.url(); | ||||
64 | QUrlQuery cleanedQuery(cleanedUrl); | ||||
65 | cleanedQuery.removeAllQueryItems(Job::StandardParams::PrettyPrint); | ||||
66 | cleanedUrl.setQuery(cleanedQuery); | ||||
67 | r.setUrl(cleanedUrl); | ||||
68 | | ||||
61 | accessManager->deleteResource(r); | 69 | accessManager->deleteResource(r); | ||
62 | } | 70 | } | ||
63 | 71 | | |||
64 | 72 | | |||
65 | void DeleteJob::handleReply(const QNetworkReply *reply, const QByteArray& rawData) | 73 | void DeleteJob::handleReply(const QNetworkReply *reply, const QByteArray& rawData) | ||
66 | { | 74 | { | ||
67 | Q_UNUSED(reply) | 75 | Q_UNUSED(reply) | ||
68 | Q_UNUSED(rawData) | 76 | Q_UNUSED(rawData) | ||
69 | 77 | | |||
70 | start(); | 78 | start(); | ||
71 | } | 79 | } |