A few WTFs for the day
Ugh. It’s one of those days where I’m being reminded that either I’m dumb or the rest of the world is, but someone is.
Case 1 – Calling each() on String in Groovy gives you every character of the string… but as a String and not a Character. I’m sure there’s a great reason for it, but it eludes me.
Case 2 – The Java Servlet API is an old friend. The person who put it together however did not understand the concept of HTTP Status codes. To send a non-”OK” response (code 200 as it happens), you have to call a method called setStatus(). However to set the string sent with the status, you have to call sendError – previously there was a setStatus(int, String) but that is deprecated. So… all responses with messages are errors now. OK. Then if you’re using Spring’s MockHttpServletResponse you find they have added getErrorMessage() to get the message set in setStatus/sendError… even though it is not necessarily an error message! Personally I think setStatus(int, String) was fine, and the mock should have getStatus() and getStatusMessage().
Rant over.
Recent Comments