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

34 lines
755 B
Markdown

```rust
let response = fetch(
"https://hatter.ink/util/print_request.action",
&FetchOptions::default())?;
```
```rust
let response = fetch(
"https://hatter.ink/util/print_request.action",
&FetchOptions {
method: FetchMethod::Put,
body: Some("{}".as_bytes().to_vec()),
..Default::default()
})?;
```
```rust
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()
})?;
```