Browse Source

Always specify Content-Type in Web API error responses

adaptive-webui-19844
Thomas Piccirello 5 years ago
parent
commit
6e4f49fc57
  1. 3
      src/webui/webapplication.cpp

3
src/webui/webapplication.cpp

@ -466,8 +466,7 @@ Http::Response WebApplication::processRequest(const Http::Request &request, cons
} }
catch (const HTTPError &error) { catch (const HTTPError &error) {
status(error.statusCode(), error.statusText()); status(error.statusCode(), error.statusText());
if (!error.message().isEmpty()) print((!error.message().isEmpty() ? error.message() : error.statusText()), Http::CONTENT_TYPE_TXT);
print(error.message(), Http::CONTENT_TYPE_TXT);
} }
for (const Http::Header &prebuiltHeader : asConst(m_prebuiltHeaders)) for (const Http::Header &prebuiltHeader : asConst(m_prebuiltHeaders))

Loading…
Cancel
Save