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:

committed by
Alexander Medvednikov

parent
4e64a58ac1
commit
df5faf35e5
@ -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())
|
||||
}
|
||||
|
Reference in New Issue
Block a user