Skip to content

Commit

Permalink
Update http client to send request parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
debermudez committed Oct 3, 2023
1 parent 1c89222 commit d6016c4
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/c++/library/http_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit d6016c4

Please sign in to comment.