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:
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user