Skip to content

Commit

Permalink
📝 Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
elbywan committed Oct 3, 2017
1 parent 0078004 commit 11094dd
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#### Because having to write two callbacks for a simple request is awkward.

```javascript
// Fetch
// Fetch needs a second callback to process the response body

fetch("examples/example.json")
.then(response => response.json())
Expand All @@ -40,7 +40,7 @@ fetch("examples/example.json")
```

```javascript
// Wretch
// Wretch does it for you

wretch("examples/example.json").get().json(json => {
// Do stuff with the parsed json
Expand All @@ -50,7 +50,7 @@ wretch("examples/example.json").get().json(json => {
#### Because manually checking and throwing every request error code is fastidious.

```javascript
// Fetch
// Fetch won’t reject on HTTP error status

fetch("anything")
.then(response => {
Expand All @@ -67,7 +67,7 @@ fetch("anything")
```

```javascript
// Wretch throws when the response contains an error code and contains helper methods for common error codes
// Wretch throws when the response is not successful and contains helper methods to handle common codes

wretch("anything")
.get()
Expand All @@ -81,7 +81,7 @@ wretch("anything")
#### Because sending a json object should be easy.

```javascript
// Fetch
// With fetch you have to set the header, the method and the body manually

fetch("endpoint", {
method: "POST",
Expand All @@ -92,7 +92,7 @@ fetch("endpoint", {
```

```javascript
// Wretch
// With wretch, you have shorthands at your disposal

wretch("endpoint")
.json({ "hello": "world" })
Expand Down

0 comments on commit 11094dd

Please sign in to comment.