print only first of two if only two arguments passed

This commit is contained in:
Francesco Mecca 2019-04-27 09:35:13 +02:00
parent bab409758c
commit 75045549a6

View file

@ -89,8 +89,11 @@ void handleRequest(scope HTTPServerRequest req, scope HTTPServerResponse res)
auto args = path[2].name.split(","); auto args = path[2].name.split(",");
const result = shuffle(args, engine); const result = shuffle(args, engine);
result.visit!((string [] r) { result.visit!((string [] r) {
immutable body = "Asino says:</br><ul>" ~ "<li>" ~ r.join("</li><li>") ~ "</ul>";
res.headers["Content-Type"] = "text/html"; res.headers["Content-Type"] = "text/html";
immutable body = "Asino says:</br>" ~
(r.length == 2 ?
r[0] :
"<ul><li>" ~ r.join("</li><li>") ~ "</ul>");
res.writeBody(body); res.writeBody(body);
}, },
(Error e) { error(); } (Error e) { error(); }