feat: add fetch-rs
This commit is contained in:
18
__network/fetch-rs/README.md
Normal file
18
__network/fetch-rs/README.md
Normal 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
|
||||
});
|
||||
```
|
||||
Reference in New Issue
Block a user