Fix build of FW part.

Add Options response to the Rest Daemon. (mandatory by Ajax request).
This commit is contained in:
2016-05-09 23:09:31 +02:00
parent ed18b11c6a
commit b613529b6c
8 changed files with 67 additions and 66 deletions

View File

@@ -111,6 +111,26 @@ bool UBusHandler::handleDelete (CivetServer *aServer, struct mg_connection *conn
return true;
}
/*! ----------------------------------------------------------------------------
* @fn handleOptions
*
* @brief Options Method for the Exit route.
*/
bool UBusHandler::handleOptions (CivetServer *aServer, struct mg_connection *aConn)
{
UNUSED_PARAMETER (aServer);
/* Add HTTP Headers. for the Responde. */
mg_printf (aConn, "HTTP/1.1 200 OK\r\n");
mg_printf (aConn, "Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept\r\n");
mg_printf (aConn, "Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS\r\n");
mg_printf (aConn, "Access-Control-Allow-Origin: *\r\n");
return true;
}
/*! ----------------------------------------------------------------------------
* @fn Exec
*

View File

@@ -43,6 +43,7 @@ public:
bool handlePost (CivetServer *server, struct mg_connection *conn);
bool handlePut (CivetServer *server, struct mg_connection *conn);
bool handleDelete (CivetServer *server, struct mg_connection *conn);
bool handleOptions (CivetServer *aServer, struct mg_connection *aConn);
private:
bool Exec (const std::string &aCommand, const std::string &aParam,