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
21 lines
643 B
C++
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;
|
|
}
|
|
}
|