mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 23:04:49 +00:00
Use reqwest::blocking::get in cli host
This commit is contained in:
parent
2d0f8482e9
commit
e052938837
1 changed files with 7 additions and 2 deletions
|
@ -48,9 +48,14 @@ pub fn roc_fx_putLine(line: RocStr) -> () {
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub fn roc_fx_httpGetUtf8(url: RocStr) -> RocStr {
|
pub fn roc_fx_httpGetUtf8(url: RocStr) -> RocStr {
|
||||||
println!("TODO: read from this URL {:?}", url);
|
let body = reqwest::blocking::get(unsafe { url.as_str() })
|
||||||
|
.unwrap_or_else(|err| todo!("Report this HTTP error: {:?}", err));
|
||||||
|
|
||||||
RocStr::from_slice("url!!!".as_bytes())
|
let str = body
|
||||||
|
.text()
|
||||||
|
.unwrap_or_else(|err| todo!("Report this body.text() error: {:?}", err));
|
||||||
|
|
||||||
|
RocStr::from_slice(str.as_bytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue