use a ternary for single assignment

This commit is contained in:
Stephen Birarda 2015-12-17 10:54:32 -08:00
parent 286b984d6f
commit 08f42c08d9

View file

@ -147,10 +147,10 @@ bool HTTPManager::handleHTTPRequest(HTTPConnection* connection, const QUrl& url,
}
// if this is an shtml file just make the MIME type match HTML so browsers aren't confused
auto mimeType = QString { "text/html" };
if (localFileInfo.suffix() != "shtml") {
mimeType = mimeDatabase.mimeTypeForFile(filePath).name();
}
// otherwise use the mimeDatabase to look it up
auto mimeType = localFileInfo.suffix() == "shtml"
? QString { "text/html" }
: mimeDatabase.mimeTypeForFile(filePath).name();
connection->respond(HTTPConnection::StatusCode200, localFileData, qPrintable(mimeType));