1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-11 23:37:59 +00:00

Merge pull request #12835 from Piccirello/web-content-type

Specify Content-Type in Web API error responses
This commit is contained in:
Mike Tzou 2020-05-20 14:05:20 +08:00 committed by GitHub
commit c85d2e547b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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))