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

const response = fetch("http://example.com/movies.json")
const responseJson = response.json();
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
});