1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

vweb: fix routing for 0 params (#5773)

This commit is contained in:
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

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 {}