You’ve finished Calling Web APIs With fetch, the last course on this path.
In This Course, You Learned How To
- Read the HTTP requests and responses that travel over the wire
- Make and inspect HTTP requests with fetch
- Read an API’s docs, and combine data from real web APIs
- Handle failed requests, slow responses and missing data
- Build a long weekend planner for four friends abroad
From the Wire to fetch()
A request and its response each have a first line and headers, and may have a body.
When Mateo typed XX, Nager.Date answered 404, and fetch() didn’t reject. Only response.ok said no, so your check threw an error. fetch() rejected with a TypeError when the request couldn’t complete.
URL and searchParams kept “Trinidad & Tobago” one value. A POST with a JSON body saved the friends’ weekend and got back 201 Created. A deadline signal stopped any request that took too long.