1
0
mirror of https://github.com/actix/examples synced 2025-06-26 09:17:41 +02:00

chore: fmt

This commit is contained in:
Rob Ede
2024-08-07 02:04:57 +01:00
parent b7b1005d2a
commit f30795f014
16 changed files with 100 additions and 89 deletions

View File

@ -20,6 +20,7 @@ cargo run (or ``cargo watch -x run``)
```
In this example, you can get the:
- successful result at [http://localhost:8080/success](http://localhost:8080/success) (accessible)
- failed result at [http://localhost:8080/fail](http://localhost:8080/fail) (inaccessible, `ERR_EMPTY_RESPONSE`).

View File

@ -1,16 +1,16 @@
function post(url = ``, data = {}) {
// Default options are marked with *
return fetch(url, {
method: 'POST', // *GET, POST, PUT, DELETE, etc.
mode: 'cors', // no-cors, cors, *same-origin
cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached
method: "POST", // *GET, POST, PUT, DELETE, etc.
mode: "cors", // no-cors, cors, *same-origin
cache: "no-cache", // *default, no-cache, reload, force-cache, only-if-cached
headers: {
'Content-Type': 'application/json; charset=utf-8',
"Content-Type": "application/json; charset=utf-8",
},
redirect: 'follow', // manual, *follow, error
referrer: 'no-referrer', // no-referrer, *client
redirect: "follow", // manual, *follow, error
referrer: "no-referrer", // no-referrer, *client
body: JSON.stringify(data), // body data type must match "Content-Type" header
}).then(response => response.json()); // parses response to JSON
}).then(response => response.json()) // parses response to JSON
}
// window.addEventListener('load', function() {