From 6bdd28a09c589cf631fce948476d48e9375f72a0 Mon Sep 17 00:00:00 2001 From: Joel Grunbaum <joelgrun@gmail.com> Date: Mon, 10 Jan 2022 04:50:34 +0000 Subject: [PATCH] Click trader working, with exchange communication --- protocol.cpp | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/protocol.cpp b/protocol.cpp index c15fded..0e168f5 100644 --- a/protocol.cpp +++ b/protocol.cpp @@ -49,17 +49,13 @@ json::Message* addOrder(json::AddMessage& order) { - std::string message = "{\"message\": " + order.as_string() + ", " + - "\"username\": \"" + std::string(USER) + - "\", \"password\": \"" + std::string(PASS) + "\"}"; + std::string message = order.as_string(); return send(message); } json::Message* deleteOrder(json::DeleteMessage& order) { - std::string message = "{\"message\": " + order.as_string() + - ", \"username\": \"" + std::string(USER) + - "\", \"password\": \"" + std::string(PASS) + "\"}"; + std::string message = order.as_string(); return send(message); } @@ -168,9 +164,13 @@ json::Message* send(std::string& message) { - auto res = cli.Post("/execution", message, "text/plain"); - std::queue<json::Message*> a = json::parse(res->body); - return a.front(); + httplib::MultipartFormDataItems a = {{"message", message, "", ""}, + {"username", USER, "", ""}, + {"password", PASS, "", ""}}; + auto res = cli.Post("/execution", a); + std::string b = res->body; + std::queue<json::Message*> c = json::parse(b); + return c.front(); } } // namespace protocol -- Gitblit v1.9.3