Files
openrouter/src/helpers.hpp
T
wt 782315b9f4
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Make (push) Has been cancelled
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-CMake (push) Has been cancelled
Prepare Build and Testing executable binary / Prepare-Build-Testing-With-Meson (push) Has been cancelled
updated and added more funcs to be small
2025-04-19 17:03:56 +07:00

21 lines
643 B
C++

#pragma once
#include <httplib.h>
#include <json.hpp>
#include <syslog.h>
inline void check_body_empty(const httplib::Request& request, httplib::Response& response, std::string required_string) {
if (request.body.empty()) {
response.set_content(required_string, JSON_TYPE);
syslog(LOG_ERR, "no body in request");
return;
}
}
inline void check_body_data(nlohmann::json body, std::string data, httplib::Response& response, std::string required_string) {
if (body[data] == nullptr) {
response.set_content(required_string, JSON_TYPE);
syslog(LOG_ERR, "Error request");
return;
}
}