vweb: fix routing for 0 params (#5773)

pull/5775/head
Louis Schmieder 2020-07-09 17:16:02 +02:00 committed by GitHub
parent c5dc1a33b6
commit 3792e17885
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -364,7 +364,7 @@ fn handle_conn<T>(conn net.Socket, mut app T) {
// since such methods have a priority.
// For example URL `/register` matches route `/:user`, but `fn register()`
// should be called first.
if (req.method == 'GET' && url_words[0] == method) || (req.method == 'POST' && url_words[0] + '_post' == method) {
if (req.method == 'GET' && url_words[0] == method && url_words.len == 1) || (req.method == 'POST' && url_words[0] + '_post' == method) {
println('easy match method=$method')
app.$method(vars)
conn.close() or {}