mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-23 11:17:15 +08:00
update
This commit is contained in:
parent
d014997d52
commit
59f9495f31
@ -19,7 +19,6 @@ Window {
|
||||
}
|
||||
request.headers["token"] ="yyds"
|
||||
request.headers["os"] ="pc"
|
||||
console.debug(JSON.stringify(request))
|
||||
return request
|
||||
}
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ FluScrollablePage{
|
||||
}
|
||||
onError:
|
||||
(status,errorString)=>{
|
||||
console.debug(status+"->"+errorString)
|
||||
showError(errorString)
|
||||
}
|
||||
onSuccess:
|
||||
|
@ -3,6 +3,8 @@
|
||||
#include <QQmlContext>
|
||||
#include <QDir>
|
||||
#include <QQuickWindow>
|
||||
#include <QNetworkProxy>
|
||||
#include <QSslConfiguration>
|
||||
#include <QProcess>
|
||||
#include <FramelessHelper/Quick/framelessquickmodule.h>
|
||||
#include <FramelessHelper/Core/private/framelessconfig_p.h>
|
||||
|
@ -10,6 +10,8 @@ FluHttp::FluHttp(QObject *parent)
|
||||
: QObject{parent}
|
||||
{
|
||||
enabledBreakpointDownload(false);
|
||||
timeout(15);
|
||||
retry(3);
|
||||
}
|
||||
|
||||
Q_INVOKABLE void FluHttp::postString(QString params,QVariantMap headers){
|
||||
@ -18,6 +20,8 @@ Q_INVOKABLE void FluHttp::postString(QString params,QVariantMap headers){
|
||||
HttpClient client;
|
||||
Q_EMIT start();
|
||||
client.post(_url)
|
||||
.retry(retry())
|
||||
.timeout(timeout())
|
||||
.bodyWithRaw(request[params].toString().toUtf8())
|
||||
.headers(request["headers"].toMap())
|
||||
.onSuccess([=](QString result) {
|
||||
@ -39,6 +43,8 @@ void FluHttp::post(QVariantMap params,QVariantMap headers){
|
||||
HttpClient client;
|
||||
Q_EMIT start();
|
||||
client.post(_url)
|
||||
.retry(retry())
|
||||
.timeout(timeout())
|
||||
.headers(headers)
|
||||
.bodyWithFormData(request["params"].toMap())
|
||||
.headers(request["headers"].toMap())
|
||||
@ -61,6 +67,8 @@ void FluHttp::postJson(QVariantMap params,QVariantMap headers){
|
||||
HttpClient client;
|
||||
Q_EMIT start();
|
||||
client.post(_url)
|
||||
.retry(retry())
|
||||
.timeout(timeout())
|
||||
.headers(headers)
|
||||
.bodyWithRaw(QJsonDocument::fromVariant(request["params"]).toJson())
|
||||
.headers(request["headers"].toMap())
|
||||
@ -83,6 +91,8 @@ void FluHttp::get(QVariantMap params,QVariantMap headers){
|
||||
HttpClient client;
|
||||
Q_EMIT start();
|
||||
client.get(_url)
|
||||
.retry(retry())
|
||||
.timeout(timeout())
|
||||
.queryParams(request["params"].toMap())
|
||||
.headers(request["headers"].toMap())
|
||||
.onSuccess([=](QString result) {
|
||||
@ -105,6 +115,8 @@ Q_INVOKABLE void FluHttp::download(QString path,QVariantMap params,QVariantMap h
|
||||
HttpClient client;
|
||||
Q_EMIT start();
|
||||
client.get(_url)
|
||||
.retry(retry())
|
||||
.timeout(timeout())
|
||||
.download(path)
|
||||
.enabledBreakpointDownload(_enabledBreakpointDownload)
|
||||
.queryParams(request["params"].toMap())
|
||||
|
@ -11,6 +11,8 @@ class FluHttp : public QObject
|
||||
Q_OBJECT
|
||||
Q_PROPERTY_AUTO(QString,url);
|
||||
Q_PROPERTY_AUTO(bool,enabledBreakpointDownload)
|
||||
Q_PROPERTY_AUTO(int,timeout)
|
||||
Q_PROPERTY_AUTO(int,retry);
|
||||
QML_NAMED_ELEMENT(FluHttp)
|
||||
private:
|
||||
QVariant invokeIntercept(const QVariant& params,const QVariant& headers,const QString& method);
|
||||
|
Loading…
Reference in New Issue
Block a user