solve exercise 6: refactoring "response HTTP code & generate json" -> "json_halt" method