fix token header name
This commit is contained in:
parent
c9c47c1297
commit
4b534505c2
@ -78,7 +78,7 @@ namespace trs
|
||||
{
|
||||
res.set_header("Access-Control-Allow-Origin", "*");
|
||||
res.set_header("Allow", "POST, HEAD, OPTIONS");
|
||||
res.set_header("Access-Control-Allow-Headers", "X-Requested-With, Content-Type, Accept, Origin, Authorization, TRS-server-function, TRS-token-auth");
|
||||
res.set_header("Access-Control-Allow-Headers", "X-Requested-With, Content-Type, Accept, Origin, Authorization, TRS-server-function, TRS-server-token");
|
||||
res.set_header("Access-Control-Allow-Methods", "OPTIONS, HEAD, POST");
|
||||
});
|
||||
}
|
||||
@ -120,13 +120,16 @@ namespace trs
|
||||
~client() = default;
|
||||
|
||||
public:
|
||||
auto notify(std::string path, std::string key, std::string data)
|
||||
auto post(std::string path, JSON&& data)
|
||||
{
|
||||
httplib::Headers headers = {
|
||||
{ "TRS-token-auth", m_token },
|
||||
{ "TRS-server-function", "notify" }
|
||||
{ "TRS-server-token", m_token },
|
||||
{ "TRS-server-function", "notify" },
|
||||
{ "Content-Type", "application/json" },
|
||||
{ "Cookie", "unione_lang=ru" }
|
||||
};
|
||||
return m_cli.Post(path, headers, httplib::Params{{key, data}});
|
||||
|
||||
return m_cli.Post(path.c_str(), headers, data.dump(),"application/json" );
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -27,7 +27,7 @@ namespace worckspaces
|
||||
auto main(int argc, char* args[]) -> int
|
||||
{
|
||||
trs::client cli {"localhost:5000", "token_auth"};
|
||||
cli.notify("/","test", "test message");
|
||||
cli.post("/",trs::JSON{{ "test", "test message" }});
|
||||
|
||||
// trs::server srv;
|
||||
// srv.init("test service", "app_connection", "log_connection");
|
||||
|
Loading…
Reference in New Issue
Block a user