HTTP 501 Not Implemented indicates the server does not recognize or support the HTTP method in the request. While 405 Method Not Allowed means the resource doesn't accept that method, 501 means the server itself doesn't support the method at all. This is rare in modern HTTP servers since all standard methods are implemented. You might encounter 501 with: custom HTTP methods (PATCH on older servers), WebDAV methods (PROPFIND, MKCOL), or when a proxy encounters an unknown method.
Response includes the status code, standard headers (including Content-Type), and a small diagnostic JSON body describing the request and returned status.
Simulator URL (copy in the app after load — not a normal link):
https://httpstatus.com/api/status/501
Example request:
curl -i "https://httpstatus.com/api/status/501"The server either does not recognize the request method, or it lacks the ability to fulfill the request.
On this code, Inspector focuses on semantics, headers, and correctness warnings that commonly affect clients and caches.
HTTP 501 Not Implemented represents a specific server-side condition that requires different handling than other 5xx errors. Understanding the precise cause helps operations teams diagnose and resolve issues faster. Monitoring systems should distinguish 501 from other 5xx codes for accurate alerting and diagnosis.
// Handle 501 Not Implemented
process.on('unhandledRejection', (reason) => {
console.error('Unhandled rejection:', reason);
});
app.use((err, req, res, next) => {
console.error(`${req.method} ${req.url}:`, err.stack);
res.status(err.status || 500).json({
error: process.env.NODE_ENV === 'production'
? 'Internal Server Error'
: err.message,
requestId: req.id
});
});from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse
import logging
logger = logging.getLogger(__name__)
@app.exception_handler(Exception)
async def server_error_handler(request: Request, exc: Exception):
logger.error(f'{request.method} {request.url}: {exc}',
exc_info=True)
return JSONResponse(
status_code=501,
content={'error': 'Not Implemented', 'request_id': request.state.id}
)@ControllerAdvice
public class GlobalErrorHandler {
private static final Logger log = LoggerFactory.getLogger(
GlobalErrorHandler.class);
@ExceptionHandler(Exception.class)
public ResponseEntity<ErrorResponse> handleException(
Exception ex, HttpServletRequest req) {
log.error("{} {}: {}", req.getMethod(),
req.getRequestURI(), ex.getMessage(), ex);
return ResponseEntity.status(501)
.body(new ErrorResponse("Not Implemented",
"An unexpected error occurred"));
}
}func errorMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
defer func() {
if err := recover(); err != nil {
log.Printf("%s %s: %v\n%s",
r.Method, r.URL, err, debug.Stack())
w.WriteHeader(501)
json.NewEncoder(w).Encode(map[string]string{
"error": "Not Implemented",
})
}
}()
next.ServeHTTP(w, r)
})
}