From d6016c442b9a36c4a9273304060ae508d681097d Mon Sep 17 00:00:00 2001 From: Elias Bermudez Date: Tue, 3 Oct 2023 14:25:55 -0700 Subject: [PATCH] Update http client to send request parameters --- src/c++/library/http_client.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/c++/library/http_client.cc b/src/c++/library/http_client.cc index eacf958da..9f2f5ab5e 100644 --- a/src/c++/library/http_client.cc +++ b/src/c++/library/http_client.cc @@ -449,6 +449,23 @@ HttpInferRequest::PrepareRequestJson( if (outputs.empty()) { parameters_json.AddBool("binary_data_output", true); } + + for (auto& param : options.request_parameters) { + if (param.second.type == "string") { + parameters_json.AddString( + param.first.c_str(), param.second.value.c_str(), + param.second.value.size()); + } else if (param.second.type == "int") { + parameters_json.AddInt( + param.first.c_str(), std::stoi(param.second.value)); + } else if (param.second.type == "bool") { + bool val = false; + if (param.second.value == "true") { + val = true; + } + parameters_json.AddBool(param.first.c_str(), val); + } + } } request_json->Add("parameters", std::move(parameters_json));