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

749 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: vec![
            FetchHeader {
                key: "content-type".to_string(),
                value: "application/json".to_string(),
            }
        ],
        body: Some("{}".as_bytes().to_vec()),
        ..Default::default()
    })?;