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 // if this is an shtml file just make the MIME type match HTML so browsers aren't confused
auto mimeType = QString { "text/html" }; // otherwise use the mimeDatabase to look it up
if (localFileInfo.suffix() != "shtml") { auto mimeType = localFileInfo.suffix() == "shtml"
mimeType = mimeDatabase.mimeTypeForFile(filePath).name(); ? QString { "text/html" }
} : mimeDatabase.mimeTypeForFile(filePath).name();
connection->respond(HTTPConnection::StatusCode200, localFileData, qPrintable(mimeType)); connection->respond(HTTPConnection::StatusCode200, localFileData, qPrintable(mimeType));