3 ms·
> return createResponse(Status::CODE_200, "Hello World!"); Is "Status::CODE_200" a useful abstraction over just "200"?
by petters 8y ago
> return createResponse(Status::CODE_200, "Hello World!");
Is "Status::CODE_200" a useful abstraction over just "200"?
- lultimouomo 8y agoAn HTTP status has both a numerical code (200) and a textual reason (OK).
- gpderetta 8y agoAssuming that's an enum, the compiler will tell you if you miss one case in a switch statement. Also if you mistype 200 for example as 20 or 2000 the compiler will also tell you. None are huge reasons, but it is nice and cheap.
- lganzzzo 8y agogood point