mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
net: return error unless response code was 200 (#10499)
This commit is contained in:
parent
4688c75389
commit
64f34f6d61
|
@ -10,6 +10,9 @@ pub fn download_file(url string, out string) ? {
|
|||
println('download file url=$url out=$out')
|
||||
}
|
||||
s := get(url) or { return err }
|
||||
if s.status_code != 200 {
|
||||
return error('received http code $s.status_code')
|
||||
}
|
||||
os.write_file(out, s.text) ?
|
||||
// download_file_with_progress(url, out, empty, empty)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user