Files
simple-rust-tests/__network/fetch-rs/README.md
2023-06-04 14:09:25 +08:00

755 B

let response = fetch(
    "https://hatter.ink/util/print_request.action",
    &FetchOptions::default())?;
let response = fetch(
    "https://hatter.ink/util/print_request.action",
    &FetchOptions {
        method: FetchMethod::Put,
        body: Some("{}".as_bytes().to_vec()),
        ..Default::default()
    })?;
let response = fetch(
    "https://hatter.ink/util/print_request.action",
    &FetchOptions {
        method: FetchMethod::Post,
        headers: Some(vec![
            FetchHeader {
                key: "content-type".to_string(),
                value: "application/json".to_string(),
            }
        ]),
        body: Some("{}".as_bytes().to_vec()),
        ..Default::default()
    })?;