Example HTTP Response
HTTP/1.1 206 Partial Content
Content-Range: bytes 0-999/5000
Content-Length: 1000- Resuming a paused download
- Video streaming seeking to specific time
- Loading large files in chunks
What does this mean?
Here's a slice of the pie! You only asked for part of the content, so that's exactly what you're getting.
Technical Definition
The server is delivering only part of the resource due to a range header sent by the client.
RFC Says
"The 206 (Partial Content) status code indicates that the server is successfully fulfilling a range request for the target resource by transferring one or more parts of the selected representation that correspond to the satisfiable ranges found in the request's Range header field."
Plain English:
The server is sending only the portion of the resource you requested via the Range header. Essential for resumable downloads, video streaming, and loading large files in chunks. The Content-Range header tells you which bytes you're receiving and the total size.
Common Misinterpretation
Don't confuse 206 with chunked transfer encoding. 206 is for requesting specific byte ranges of a resource, while chunked encoding is about how the response is transmitted. You can have 200 OK with chunked encoding, or 206 with or without chunking.
Ready-to-use code for returning this HTTP status in your application:
// Express.js
app.get('/example', (req, res) => {
res.status(206).json({
error: 'Partial Content',
message: 'Your error message here'
});
});
// Native HTTP
const http = require('http');
http.createServer((req, res) => {
res.writeHead(206, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({
error: 'Partial Content',
message: 'Your error message here'
}));
}).listen(3000);