Loading topic
fetch(), what its Promise gives you, and why getting data out of a response takes two steps.3 min readasync functions, use await, and know what HTTP status codes and headers are. It also assumes you have made a basic fetch() call, as the previous chapter showed.2 min readfetch(), and can read response.status and response.ok from the previous chapter. In this chapter you will turn the bytes the server sent into data your code can use.3 min readasync/await, and try/catch. It also assumes you know the Response properties status, ok, and statusText from the earlier chapter on inspecting the response.2 min readfetch(), check response.ok, and read a body with response.json(). It also assumes you know what HTTP methods and headers are. Until now, every request has been a plain GET. Here you will learn how to describe any request using the second argument to fetch().3 min readfetch() with method, headers, and body, and how to check response.ok and read a JSON response. This chapter covers what goes inside body and which Content-Type belongs with each kind of body.2 min readfetch(), how to pass an options object with method, headers, and body, and how to read response.status and response.ok. In earlier chapters you passed headers as a plain object. Here you will use the Headers interface, the object the browser ac2 min readfetch() resolves to a Response that you check with response.ok. Earlier chapters covered those points. Here you will learn how to stop a request that is still running, either because the user no longer needs the result or because the 2 min readasync functions, check response.ok before parsing a body, and read JSON with response.json(). Earlier chapters covered those steps. Here you will start several requests at the same time and collect their results.3 min readfetch(), set request options such as method and headers, and check response.ok. You should also be able to open the browser's network panel and look at request and response headers.3 min readasync/await, with checking response.ok, and with the fact that a response body can be read only once. Earlier chapters read bodies with json() or text(), which wait for the whole response before giving you anything. For large downloads, slow se3 min readresponse.ok, reading bodies with json() and text(), sending JSON with JSON.stringify, and timeouts with AbortSignal.timeout(). You should also be fluent with async/await and try/catch.2 min read