Always specify Content-Type in Web API error responses

This commit is contained in:
Thomas Piccirello 2020-05-13 15:54:58 -07:00
parent 841536c9c5
commit 6e4f49fc57

View file

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