Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
devios157707y@filthyranter Not necessarily 500, but when you send a message to an API and it returns 200 along with an error message… that really grinds my gears.
-
Jacobgc9107ySome sites use it to stop some automated bots (that are designed to find exploitable flaws in a site) that are searching for a 500 error code. However chances are this sites Dev is lazy
-
devios157707yFirst of all, I disagree with that, but it is pretty filthy trick. And second of all, it should be a 400 series error in this case since I was providing bad input.
-
devios157707yEven if you're trying to hide server errors, at least return something that is technically an error code, like a 404 or something. Don't return success.
-
620hun83707yI had this with Django. I kept getting 200 (but the actual page showed a 403) instead of 403. Then magically it started working properly, I still don't understand why.
-
Personally, I don't mind much getting 200s provided they provide a boolean success.
if (response.success) {
console.log('✓');
} else {
console.log('✘');
}
It's easy enough to understand and as and when you refactor to use more semantic status codes it's easily split into
.then(
function success(response) {
console.log(response.message);
},
function error(response) {
console.log(response.message);
}
); -
devios157707yI mean, I get that this is a part of REST, but they nailed it and we absolutely should adopt that standard everywhere. Even if it's just a generic 400 Bad Request. It conveys that the error is on the client side in a universally understood way.
-
chadd1746437yI'm working on a project where django rest framework's create function was overwritten to give a hardcoded 200. You could check that?
Related Rants
HTTP 200 responses on failures… 😒
undefined
success error
fail
this is basic stuff
rest
why?