1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-02 14:04:46 -04:00

Web API: send API documentation if path is invalid

This commit is contained in:
f4exb
2017-11-20 18:38:26 +01:00
parent 7fa26835bd
commit 1b5f944302
9 changed files with 9091 additions and 5 deletions
+14 -2
View File
@@ -16,6 +16,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include "httpdocrootsettings.h"
#include "webapirequestmapper.h"
#include "SWGInstanceSummaryResponse.h"
#include "SWGErrorResponse.h"
@@ -23,7 +24,16 @@
WebAPIRequestMapper::WebAPIRequestMapper(QObject* parent) :
HttpRequestHandler(parent),
m_adapter(0)
{ }
{
qtwebapp::HttpDocrootSettings docrootSettings;
docrootSettings.path = ":/";
m_staticFileController = new qtwebapp::StaticFileController(docrootSettings, parent);
}
WebAPIRequestMapper::~WebAPIRequestMapper()
{
delete m_staticFileController;
}
void WebAPIRequestMapper::service(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response)
{
@@ -61,7 +71,9 @@ void WebAPIRequestMapper::service(qtwebapp::HttpRequest& request, qtwebapp::Http
}
else
{
response.setStatus(404,"Not found");
QByteArray path = "/";
m_staticFileController->service(path, response);
//response.setStatus(404,"Not found");
}
}
}