mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
vweb: Implement chunked encoding transfer (#8179)
This commit is contained in:
@@ -106,6 +106,13 @@ fn test_http_client_index() {
|
||||
assert x.text == 'Welcome to VWeb'
|
||||
}
|
||||
|
||||
fn test_http_client_chunk_transfer() {
|
||||
x := http.get('http://127.0.0.1:$sport/chunk') or { panic(err) }
|
||||
assert_common_http_headers(x)
|
||||
assert x.headers['Transfer-Encoding'] == 'chunked'
|
||||
assert x.text == 'Lorem ipsum dolor sit amet, consetetur sadipscing'
|
||||
}
|
||||
|
||||
fn test_http_client_404() {
|
||||
url_404_list := [
|
||||
'http://127.0.0.1:$sport/zxcnbnm',
|
||||
|
||||
@@ -56,6 +56,11 @@ pub fn (mut app App) html_page() vweb.Result {
|
||||
return app.html('<h1>ok</h1>')
|
||||
}
|
||||
|
||||
pub fn (mut app App) chunk() vweb.Result {
|
||||
app.enable_chunked_transfer(20)
|
||||
return app.html('Lorem ipsum dolor sit amet, consetetur sadipscing')
|
||||
}
|
||||
|
||||
// the following serve custom routes
|
||||
['/:user/settings']
|
||||
pub fn (mut app App) settings(username string) vweb.Result {
|
||||
|
||||
Reference in New Issue
Block a user