You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Repository owner locked and limited conversation to collaborators on Jul 13, 2023
Activity
Desdaemon commentedon Jul 13, 2023
You'll need to use
#[cfg]attributes to enable Tokio only for non-web users andwasm-bindgen-futuresfor web users. Also I'll open discussions so common questions like this can be collected in one place.