1
0
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:
JalonSolov 2021-06-17 18:28:40 -04:00 committed by GitHub
parent 4688c75389
commit 64f34f6d61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
}