feat: add fetch-rs

This commit is contained in:
2023-06-04 13:54:54 +08:00
parent 2b71b456a3
commit c259d6c102
5 changed files with 1374 additions and 1 deletions

View File

@@ -0,0 +1,18 @@
```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
});
```