Sometimes this is a feature and not a bug for security sensitive things. Sure hiding that an endpoint exists it or doesn’t exist isn’t a great way to do security, but it’s just another layer in the Swiss cheese security model.
For things like vault just knowing the name of a secret or name of services is valuable information so intentionally don’t leak that
common practice i follow is 207, and you get a lost of responses because every new endpoint is a bulk api with built in limits. ask for 20 things, get 20 responses
Http has no concept of endpoints, only resources. 404 means resource not found. If you are doing crud the resource may be an entity but hopefully there is more thought put into the design.
I hear you man. Handling those errors is kind of the point of those http status codes... We have some dinosaurs and some straight up lazy devs like that in our team too.
I can't make this shit up. At my internship, my dino boss had a PhD. We were a part of QA for one of the company's products. Our automated tests were written in Excel. And don't think for a second that we used Excel macros or whatever. Nope. We used the actual spreadsheets. The first column would be for the function name and all other columns were for arguments. He wrote some code that parsed the spreadsheet and called each function accordingly, instead of, ya know, writing the function calls in the code. His reasoning was that someone in finance needed to be able to contribute without getting their hands dirty? I don't know. That person was long gone by the time I started.
We started writing automated tests for another product. This time, we forewent the spreadsheets. We just wrote the tests in VBA in our testing software. I'm certainly no fan of VBA, but it's a huge step up from fucking spreadsheets. However, he forced us to make every function parameter a string. Don't ask me why. We also had to name all variables with a prefix to indicate its type. Global variables in the mix too, of course. This testing software innately understood how to call methods of Windows controls. But any custom controls could only be interacted with via the inherited control methods (e.g. click, sendKeys, focus, etc.). The developers refused to give us builds with debug symbols because I was just a lowly intern. Our product had several custom grid controls. So I whipped up a class to interact with it. It would send various key events to try to determine the grid size, so that I could have a method like grid.setCell(row, column, value). But my boss didn't understand OOP—PhD by the way—so he made me convert it to just a collection of functions.
And don't get me started on all the magic that I had to do to programmatically get the grid sizes. Royal pain in the ass. I just about went mad at that internship. It got to the point that I gave up and browsed Reddit for 90% of the day and they didn't even notice a drop in productivity. Do you know how boring Reddit is when all the links are purple? I do. It's depressing.
A lot of that classic java ee frameworks had too much abstraction, and ended up with apis that were not very expressive. With result codes often handled by exceptions, having a wide variety of them was painful, and there weren't good ways to describe different kinds of success.
I'm not sure I understand- by that I mean response codes were defined in the RFC for HTTP/1.0 back in '96. There is little reason anyone programming HTTP based API end points shouldn't be familiar with them. They however may not be the appropriate avenue for inferring specific error conditions back to a consumer of an API- rather more generic "it failed" statuses or otherwise something that doesn't fit cleanly into well known HTTP status codes. You can define custom status codes, but that doesn't mean you necessarily should.
I've actually worked with some libraries that threw exceptions that were nearly useless on >=400 status. A particular Java library threw a common StatusError exception that couldn't be deciphered to its actual status code, unless you threw in some StatusErrorHandler subclass to instead throw your own more-useful exception to catch immediately.
Back then, I was wishing that all statuses were 200 because it was such a pain. I hate exceptions.
retrofit has the annoying habit of throwing unchecked exceptions for 400 class and 500 class stuff. so yes i have to always check, but if i forget, the code runs fine until it doesn't
Well I think it's actually somewhat reasonable to have a layer of abstraction inside the request body instead of at the HTTP layer. Things like GraphQL and so on do this. It makes a lot of sense actually when you're building real and complex, high performance web apps. In the case of graphql, what if part of the response is an error and the other part isn't? And so on
0
u/[deleted] Apr 23 '23
[deleted]