Fix build of FW part.
Add Options response to the Rest Daemon. (mandatory by Ajax request).
This commit is contained in:
@@ -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
|
||||
*
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user