зеркало из https://github.com/nextcloud/desktop.git
JsonApiJob: Add method usePOST to allow anonymous POST requests
Signed-off-by: Michael Schuster <michael@schuster.ms>
This commit is contained in:
Родитель
2039872ee5
Коммит
9447a10716
|
@ -801,7 +801,7 @@ void JsonApiJob::start()
|
|||
auto query = _additionalParams;
|
||||
query.addQueryItem(QLatin1String("format"), QLatin1String("json"));
|
||||
QUrl url = Utility::concatUrlPath(account()->url(), path(), query);
|
||||
sendRequest("GET", url, _request);
|
||||
sendRequest(_usePOST ? "POST" : "GET", url, _request);
|
||||
AbstractNetworkJob::start();
|
||||
}
|
||||
|
||||
|
|
|
@ -373,6 +373,16 @@ public:
|
|||
void addQueryParams(const QUrlQuery ¶ms);
|
||||
void addRawHeader(const QByteArray &headerName, const QByteArray &value);
|
||||
|
||||
/**
|
||||
* @brief usePOST - allow job to do an anonymous POST request instead of GET
|
||||
* @param params: (optional) true for POST, false for GET (default).
|
||||
*
|
||||
* This function needs to be called before start() obviously.
|
||||
*/
|
||||
void usePOST(bool usePOST = true) {
|
||||
_usePOST = usePOST;
|
||||
}
|
||||
|
||||
public slots:
|
||||
void start() override;
|
||||
|
||||
|
@ -398,6 +408,8 @@ signals:
|
|||
private:
|
||||
QUrlQuery _additionalParams;
|
||||
QNetworkRequest _request;
|
||||
|
||||
bool _usePOST = false;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче