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

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