1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-07 16:34:45 -04:00

Web API: return 404 with API HTML documentation if URL is incorrect. Avoids response OK mistaken when not using a browser

This commit is contained in:
f4exb
2017-12-12 15:58:04 +01:00
parent e4b65b52b4
commit c22460723c
4 changed files with 18 additions and 6 deletions
+3 -2
View File
@@ -106,6 +106,7 @@ void WebAPIRequestMapper::service(qtwebapp::HttpRequest& request, qtwebapp::Http
else
{
QByteArray path = "/index.html";
response.setStatus(404, "Page not found");
m_staticFileController->service(path, response);
}
@@ -1092,7 +1093,7 @@ bool WebAPIRequestMapper::validateChannelSettings(SWGSDRangel::SWGChannelSetting
{
if (channelSettings.getTx() == 0)
{
QJsonObject nfmDemodSettingsJsonObject = jsonObject["nfmDemodSettings"].toObject();
QJsonObject nfmDemodSettingsJsonObject = jsonObject["NFMDemodSettings"].toObject();
channelSettings.setNfmDemodSettings(new SWGSDRangel::SWGNFMDemodSettings());
channelSettings.getNfmDemodSettings()->fromJsonObject(nfmDemodSettingsJsonObject);
return true;
@@ -1105,7 +1106,7 @@ bool WebAPIRequestMapper::validateChannelSettings(SWGSDRangel::SWGChannelSetting
{
if (channelSettings.getTx() != 0)
{
QJsonObject nfmModSettingsJsonObject = jsonObject["nfmModSettings"].toObject();
QJsonObject nfmModSettingsJsonObject = jsonObject["NFMModSettings"].toObject();
channelSettings.setNfmModSettings(new SWGSDRangel::SWGNFMModSettings());
channelSettings.getNfmModSettings()->fromJsonObject(nfmModSettingsJsonObject);
return true;