mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vweb: remove return vweb.Result{}
everywhere
This commit is contained in:
@@ -5,29 +5,26 @@ struct App {
|
||||
}
|
||||
|
||||
pub fn (mut app App) no_attributes(a string) vweb.Result {
|
||||
return vweb.Result{}
|
||||
return app.text('ok')
|
||||
}
|
||||
|
||||
// works fine, as long as fcn gets 1 arg and route takes 1 var
|
||||
['/foo/:bar']
|
||||
pub fn (mut app App) foo(a string) vweb.Result {
|
||||
eprintln('foo')
|
||||
app.html('works')
|
||||
return vweb.Result{}
|
||||
return app.html('works')
|
||||
}
|
||||
|
||||
// segfault because path taks 0 vars and fcn takes 1 arg
|
||||
['/bar']
|
||||
pub fn (mut app App) bar(a string) vweb.Result {
|
||||
app.html('works')
|
||||
return vweb.Result{}
|
||||
return app.html('works')
|
||||
}
|
||||
|
||||
// no segfault, but it shouldnt compile
|
||||
['/cow/:low']
|
||||
pub fn (mut app App) cow() vweb.Result {
|
||||
app.html('works')
|
||||
return vweb.Result{}
|
||||
return app.html('works')
|
||||
}
|
||||
|
||||
pub fn (app App) init_once() {
|
||||
|
@@ -53,8 +53,7 @@ pub fn (mut app App) simple() vweb.Result {
|
||||
}
|
||||
|
||||
pub fn (mut app App) html_page() vweb.Result {
|
||||
app.html('<h1>ok</h1>')
|
||||
return vweb.Result{}
|
||||
return app.html('<h1>ok</h1>')
|
||||
}
|
||||
|
||||
// the following serve custom routes
|
||||
@@ -63,8 +62,7 @@ pub fn (mut app App) settings(username string) vweb.Result {
|
||||
if username !in known_users {
|
||||
return app.not_found()
|
||||
}
|
||||
app.html('username: $username')
|
||||
return vweb.Result{}
|
||||
return app.html('username: $username')
|
||||
}
|
||||
|
||||
['/:user/:repo/settings']
|
||||
@@ -72,8 +70,7 @@ pub fn (mut app App) user_repo_settings(username string, repository string) vweb
|
||||
if username !in known_users {
|
||||
return app.not_found()
|
||||
}
|
||||
app.html('username: $username | repository: $repository')
|
||||
return vweb.Result{}
|
||||
return app.html('username: $username | repository: $repository')
|
||||
}
|
||||
|
||||
[post]
|
||||
|
Reference in New Issue
Block a user