mirror of
https://github.com/vlang/v.git
synced 2025-09-10 07:47:20 -04:00
vweb: fix routes without results in vweb_app_test.v (#20548)
This commit is contained in:
parent
508117d62f
commit
3b19864aa3
@ -18,13 +18,13 @@ struct Article {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn test_a_vweb_application_compiles() {
|
fn test_a_vweb_application_compiles() {
|
||||||
spawn fn () {
|
|
||||||
time.sleep(2 * time.second)
|
|
||||||
exit(0)
|
|
||||||
}()
|
|
||||||
vweb.run(&App{}, 18081)
|
vweb.run(&App{}, 18081)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn (mut app App) before_accept_loop() {
|
||||||
|
exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn (mut app App) before_request() {
|
pub fn (mut app App) before_request() {
|
||||||
app.user_id = app.get_cookie('id') or { '0' }
|
app.user_id = app.get_cookie('id') or { '0' }
|
||||||
}
|
}
|
||||||
@ -49,18 +49,18 @@ pub fn (mut app App) new_article() vweb.Result {
|
|||||||
return app.redirect('/')
|
return app.redirect('/')
|
||||||
}
|
}
|
||||||
|
|
||||||
fn (mut app App) time() {
|
fn (mut app App) time() vweb.Result {
|
||||||
app.text(time.now().format())
|
return app.text(time.now().format())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn (mut app App) time_json() {
|
fn (mut app App) time_json() vweb.Result {
|
||||||
app.json({
|
return app.json({
|
||||||
'time': time.now().format()
|
'time': time.now().format()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn (mut app App) time_json_pretty() {
|
fn (mut app App) time_json_pretty() vweb.Result {
|
||||||
app.json_pretty({
|
return app.json_pretty({
|
||||||
'time': time.now().format()
|
'time': time.now().format()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user