mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vweb: add an overridable .not_found() method, for making a custom 404 page + tests fixes (#17936)
This commit is contained in:
@@ -124,14 +124,16 @@ fn test_http_client_index() {
|
||||
}
|
||||
|
||||
fn test_http_client_404() {
|
||||
server := 'http://${localserver}'
|
||||
url_404_list := [
|
||||
'http://${localserver}/zxcnbnm',
|
||||
'http://${localserver}/JHKAJA',
|
||||
'http://${localserver}/unknown',
|
||||
'/zxcnbnm',
|
||||
'/JHKAJA',
|
||||
'/unknown',
|
||||
]
|
||||
for url in url_404_list {
|
||||
res := http.get(url) or { panic(err) }
|
||||
res := http.get('${server}${url}') or { panic(err) }
|
||||
assert res.status() == .not_found
|
||||
assert res.body == '404 on "${url}"'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,7 +236,6 @@ fn test_http_client_shutdown_does_not_work_without_a_cookie() {
|
||||
return
|
||||
}
|
||||
assert x.status() == .not_found
|
||||
assert x.body == '404 Not Found'
|
||||
}
|
||||
|
||||
fn testsuite_end() {
|
||||
|
||||
Reference in New Issue
Block a user