net: return error unless response code was 200 (#10499)
parent
4688c75389
commit
64f34f6d61
|
@ -10,6 +10,9 @@ pub fn download_file(url string, out string) ? {
|
||||||
println('download file url=$url out=$out')
|
println('download file url=$url out=$out')
|
||||||
}
|
}
|
||||||
s := get(url) or { return err }
|
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) ?
|
os.write_file(out, s.text) ?
|
||||||
// download_file_with_progress(url, out, empty, empty)
|
// download_file_with_progress(url, out, empty, empty)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue