Skip to main content

fetch

Function fetch 

Source
pub fn fetch(req: &Request) -> Result<Response, HttpError>
Expand description

Perform the request, blocking the calling thread until the response (or Request::timeout). Run it on your own thread; calling this on the UI thread stalls the app (docs/http.md). On the web (web-dom) blocking is impossible on the single browser thread: this returns HttpError::Unsupported there; use fetch_async or fetch_future.

ยงErrors

The HttpError the request fails with, or HttpError::Unsupported where the calling thread cannot block: the web, and the JS thread on HarmonyOS.