Example HTTP Response
HTTP/1.1 300 Multiple Choices
Content-Type: application/json
{"choices": ["/doc.pdf", "/doc.html"]}- Resource available in multiple formats
- Content negotiation with multiple options
- Multiple language versions available
What does this mean?
Pick a door! There are multiple versions of what you're looking for. Choose wisely!
Technical Definition
The request has more than one possible response. The user or user agent should choose one of them.
RFC Says
"The 300 (Multiple Choices) status code indicates that the target resource has more than one representation, each with its own more specific identifier, and information about the alternatives is being provided so that the user (or user agent) can select a preferred representation by redirecting its request to one or more of those identifiers."
Plain English:
The resource you requested is available in multiple formats or versions (like PDF, HTML, different languages). The server is giving you a list to choose from. Rarely used in practice - most servers use content negotiation instead.
Ready-to-use code for returning this HTTP status in your application:
// Express.js
app.get('/example', (req, res) => {
res.status(300).json({
error: 'Multiple Choices',
message: 'Your error message here'
});
});
// Native HTTP
const http = require('http');
http.createServer((req, res) => {
res.writeHead(300, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({
error: 'Multiple Choices',
message: 'Your error message here'
}));
}).listen(3000);