Hello, I would like to ask a question, I added a http request code, the mobile is normal, but the web does not return, I want to know where is my problem, web http request code like this:
use gloo_net::http::{Headers, Request};
#[tokio::main(flavor = "current_thread")]
pub fn request(params: MyRequest) -> Result<String> {
let headers = get_web_default_headers().unwrap();
for header in ¶ms.headers {
headers.set(&header.key, &header.value);
}
let result = Request::get(¶ms.url).headers(headers).send().await?;
Ok(result.text().await?)
}
You'll need to use #[cfg] attributes to enable Tokio only for non-web users and wasm-bindgen-futures for web users. Also I'll open discussions so common questions like this can be collected in one place.
Hello, I would like to ask a question, I added a http request code, the mobile is normal, but the web does not return, I want to know where is my problem, web http request code like this: