The Fetch API's Request Object

The Fetch API's Request object is a blueprint for an HTTP call, bundling URL, method, headers, and body. It's key for intercepting traffic in service workers or building reusable fetches. The main footgun: its body is a stream that can only be read once.
The Fetch API's Request object is an immutable blueprint for an HTTP call, bundling the URL, method, headers, body, and cache policy. You'll handle these when intercepting network traffic in service workers or creating complex, reusable fetches. The main footgun: the request body is a stream and can only be read once. To access it multiple times, you must explicitly call `request.clone()` to create a copy, otherwise you'll get an error.
Read the original → developer.mozilla.org
- #fetch api
- #web apis
- #service workers
- #http
Get five bites like this every day.
Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.