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

compiler: optionals default value

This commit is contained in:
joe-conigliaro
2019-11-04 10:38:49 +11:00
committed by Alexander Medvednikov
parent 4e64a58ac1
commit df5faf35e5
14 changed files with 86 additions and 26 deletions

View File

@ -10,13 +10,13 @@ fn (req &Request) http_do(port int, method, host_name, path string) ?Response {
s := req.build_request_headers(method, host_name, path)
client := net.dial( host_name, port) or { return error(err) }
client.send( s.str, s.len )
client.send( s.str, s.len ) or {}
for {
readbytes := client.crecv( rbuffer, bufsize )
if readbytes < 0 { return error('http_do error reading response. readbytes: $readbytes') }
if readbytes == 0 { break }
sb.write( tos(rbuffer, readbytes) )
}
client.close()
client.close() or {}
return parse_response(sb.str())
}