diff --git a/tests/vibe.web.web/source/app.d b/tests/vibe.web.web/source/app.d index 1a73f08367..ea0181e2ac 100644 --- a/tests/vibe.web.web/source/app.d +++ b/tests/vibe.web.web/source/app.d @@ -15,7 +15,7 @@ class Service { @noRoute void getFoo(HTTPServerResponse res) { res.writeBody("oops"); } void getBar(HTTPServerResponse res) { res.writeBody("ok"); } // you can work with Json objects directly - auto postJson(Json json) { return json; } + auto postJson(Json _json) { return _json; } } shared static this() diff --git a/web/vibe/web/web.d b/web/vibe/web/web.d index 1c97331721..335d4dfeda 100644 --- a/web/vibe/web/web.d +++ b/web/vibe/web/web.d @@ -912,6 +912,8 @@ private void handleRequest(string M, alias overload, C, ERROR...)(HTTPServerRequ else static if (is(PT == HTTPServerRequest) || is(PT == HTTPRequest)) params[i] = req; else static if (is(PT == HTTPServerResponse) || is(PT == HTTPResponse)) params[i] = res; else static if (is(PT == Json)) { + import std.algorithm.comparison : among; + static assert(param_names[i].among("_body", "_json", "The Json parameter must be named _body or _json.")); enforceBadRequest(req.json.type != Json.Type.undefined, "Invalid Json passed."); params[i] = req.json; }