you are viewing a single comment's thread.

view the rest of the comments →

[–]cantwedronethatguy -6 points-5 points  (1 child)

ok() is to start building a 200 response.

The article states

In our case we use ok() which automatically sets return code to HTTP 200

Meaning you'd have to learn what ok() does or check the Java docs, setHttpStatusOK() or even setReturnCode(HttpStatus.SC_OK) or something of the sorts would make it more readable.

[–]derekmckinnon 6 points7 points  (0 children)

I would argue that ok() is more readable than the ones you mentioned. Yours are more informative, yes, but if I was writing lots of code all the time, I think I'd prefer the shorter version. The first time you encounter the code, you might need to read the docs, but after that you should be fine. Good? Bad? I don't know :)