Files
simple-rust-tests/__network/fetch-rs/README.md
2023-06-04 13:54:54 +08:00

19 lines
464 B
Markdown

```js
const response = fetch("http://example.com/movies.json")
const responseJson = response.json();
```
```js
const response = fetch(url, {
method: "POST", // *GET, POST, PUT, DELETE, etc.
headers: {
"Content-Type": "application/json",
// 'Content-Type': 'application/x-www-form-urlencoded',
},
redirect: "follow", // manual, *follow, error
body: JSON.stringify(data), // body data type must match "Content-Type" header
});
```