diff --git a/example/qml-Qt6/page/T_Http.qml b/example/qml-Qt6/page/T_Http.qml index 057862b9..3402cbf5 100644 --- a/example/qml-Qt6/page/T_Http.qml +++ b/example/qml-Qt6/page/T_Http.qml @@ -60,7 +60,6 @@ FluContentPage{ onCache: (result)=>{ text_info.text = result - console.debug(result) } } diff --git a/example/qml/page/T_Http.qml b/example/qml/page/T_Http.qml index 7a71889a..31430c7b 100644 --- a/example/qml/page/T_Http.qml +++ b/example/qml/page/T_Http.qml @@ -61,7 +61,6 @@ FluContentPage{ onCache: (result)=>{ text_info.text = result - console.debug(result) } } diff --git a/src/FluHttp.cpp b/src/FluHttp.cpp index 3ea00b0f..20764b3e 100644 --- a/src/FluHttp.cpp +++ b/src/FluHttp.cpp @@ -21,8 +21,9 @@ HttpRequest::HttpRequest(QObject *parent) QMap HttpRequest::toMap(){ QVariant _params; + bool isPostString = method() == "postString"; if(params().isNull()){ - if(method() == "postString"){ + if(isPostString){ _params = ""; }else{ _params = QMap(); @@ -38,16 +39,20 @@ QMap HttpRequest::toMap(){ } QMap request = { {"url",url()}, - {"params",_params}, - {"headers",_headers}, + {"headers",_headers.toMap()}, {"method",method()}, {"downloadSavePath",downloadSavePath()} }; + if(isPostString){ + request.insert("params",_params.toString()); + }else{ + request.insert("params",_params.toMap()); + } return request; } QString HttpRequest::httpId(){ - return FluTools::getInstance()->sha256(QJsonDocument::fromVariant(QVariant(toMap())).toJson()); + return FluTools::getInstance()->sha256(QJsonDocument::fromVariant(QVariant(toMap())).toJson(QJsonDocument::Compact)); } HttpCallable::HttpCallable(QObject *parent)