fix impl client

This commit is contained in:
chatlanin 2024-07-13 20:57:14 +03:00
parent 1b963a7486
commit b57467a722
2 changed files with 4 additions and 4 deletions

View File

@ -120,16 +120,16 @@ namespace trs
~client() = default; ~client() = default;
public: public:
auto post(std::string path, JSON&& data) auto post(std::string func_name, JSON&& data)
{ {
httplib::Headers headers = { httplib::Headers headers = {
{ "TRS-server-token", m_token }, { "TRS-server-token", m_token },
{ "TRS-server-function", "notify" }, { "TRS-server-function", func_name },
{ "Content-Type", "application/json" }, { "Content-Type", "application/json" },
{ "Cookie", "unione_lang=ru" } { "Cookie", "unione_lang=ru" }
}; };
return m_cli.Post(path.c_str(), headers, data.dump(),"application/json" ); return m_cli.Post("/", headers, data.dump(),"application/json" );
} }
private: private:

View File

@ -27,7 +27,7 @@ namespace worckspaces
auto main(int argc, char* args[]) -> int auto main(int argc, char* args[]) -> int
{ {
// trs::client cli {"localhost:5000", "token_auth"}; // trs::client cli {"localhost:5000", "token_auth"};
// cli.post("/",trs::JSON{{ "key", "test message" }}); // cli.post("func_name",trs::JSON{{ "key", "test message" }});
trs::server srv; trs::server srv;
srv.init("test service", "app_connection", "log_connection"); srv.init("test service", "app_connection", "log_connection");