From a0c58a53b3db7710c333da66cde3125ea74559b8 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 24 Oct 2019 00:02:54 +0200 Subject: NETWORKING: Changed PostRequest to accept JSONValue --- backends/networking/curl/curljsonrequest.h | 1 + backends/networking/curl/postrequest.cpp | 4 ++-- backends/networking/curl/postrequest.h | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) (limited to 'backends/networking/curl') diff --git a/backends/networking/curl/curljsonrequest.h b/backends/networking/curl/curljsonrequest.h index 11c6bc81ea..e462d5890f 100644 --- a/backends/networking/curl/curljsonrequest.h +++ b/backends/networking/curl/curljsonrequest.h @@ -31,6 +31,7 @@ namespace Networking { typedef Response JsonResponse; typedef Common::BaseCallback *JsonCallback; +typedef Common::BaseCallback *JSONValueCallback; #define CURL_JSON_REQUEST_BUFFER_SIZE 512 * 1024 diff --git a/backends/networking/curl/postrequest.cpp b/backends/networking/curl/postrequest.cpp index 0becc8eef9..1dec36b670 100644 --- a/backends/networking/curl/postrequest.cpp +++ b/backends/networking/curl/postrequest.cpp @@ -28,7 +28,7 @@ namespace Networking { -PostRequest::PostRequest(Common::String url, byte *postData, int postLen, Networking::JsonCallback cb, Networking::ErrorCallback ecb): +PostRequest::PostRequest(Common::String url, byte *postData, int postLen, Networking::JSONValueCallback cb, Networking::ErrorCallback ecb): Networking::Request(nullptr, ecb), _url(url), _jsonCallback(cb), _workingRequest(nullptr), _ignoreCallback(false), _postData(postData), _postLen(postLen) { start(); @@ -87,7 +87,7 @@ void PostRequest::responseCallback(Networking::JsonResponse response) { finishSuccess(); if (_jsonCallback) - (*_jsonCallback)(Networking::JsonResponse(this, json)); + (*_jsonCallback)(json); delete json; } diff --git a/backends/networking/curl/postrequest.h b/backends/networking/curl/postrequest.h index 775af31a3f..568979473c 100644 --- a/backends/networking/curl/postrequest.h +++ b/backends/networking/curl/postrequest.h @@ -30,7 +30,7 @@ namespace Networking { class PostRequest: public Networking::Request { Common::String _url; - Networking::JsonCallback _jsonCallback; + Networking::JSONValueCallback _jsonCallback; Request *_workingRequest; bool _ignoreCallback; Common::String _date; @@ -43,7 +43,7 @@ class PostRequest: public Networking::Request { void errorCallback(Networking::ErrorResponse error); public: - PostRequest(Common::String url, byte *postData, int postLen, Networking::JsonCallback cb, Networking::ErrorCallback ecb); + PostRequest(Common::String url, byte *postData, int postLen, Networking::JSONValueCallback cb, Networking::ErrorCallback ecb); virtual ~PostRequest(); virtual void handle(); -- cgit v1.2.3