pep8 style
refactor is_json into request and fix in custom_error_handler