easy5 pts · first answer countsapi-designhttp-clientjavascript
fetch treats a 404 as success
This code never reaches the catch block when the API returns 404. Why?
try {
const res = await fetch('/api/orders/9')
const order = await res.json()
show(order)
} catch (e) {
showError(e)
}Discussion 0
Join free to post in the discussion.
Related questions
- Response for a successful DELETEBackend Developer
- A product page removed for goodBackend Developer
- Signing up with a taken usernameBackend Developer
- Calling DELETE on a read-only routeBackend Developer
- A client posts XML to a JSON APIBackend Developer
- URL for one productBackend Developer
- Telling the client where the new item livesBackend Developer
- Filtering and sorting a listBackend Developer