You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
604 B
23 lines
604 B
|
|
#include "CorsHttpServer.h"
|
|
|
|
namespace jsonrpc
|
|
{
|
|
|
|
bool CorsHttpServer::SendResponse(const std::string &response, void *addInfo)
|
|
{
|
|
struct mg_connection* conn = (struct mg_connection*) addInfo;
|
|
if (mg_printf(conn, "HTTP/1.1 200 OK\r\n"
|
|
"Content-Type: application/json\r\n"
|
|
"Content-Length: %d\r\n"
|
|
"Access-Control-Allow-Origin: *\r\n"
|
|
"Access-Control-Allow-Headers: Content-Type\r\n"
|
|
"\r\n"
|
|
"%s",(int)response.length(), response.c_str()) > 0)
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
|
|
|
|
}
|
|
|