magpie/API/requests/post.cpp

18 lines
542 B
C++
Raw Normal View History

2024-01-20 21:17:21 +00:00
//SPDX-FileCopyrightText: 2023 Yury Gubich <blue@macaw.me>
//SPDX-License-Identifier: GPL-3.0-or-later
#include "post.h"
Request::Post::Post (const QUrl& url, const QUrlQuery& form):
Request(url),
form(form)
{}
void Request::Post::aquireRequest (QNetworkAccessManager& manager) {
reply = std::unique_ptr<QNetworkReply, NetworkReplyDeleter>(manager.post(request, form.toString(QUrl::FullyEncoded).toUtf8()));
}
void Request::Post::initializeRequest () {
request.setHeader(QNetworkRequest::ContentTypeHeader, urlEncoded);
}