Checking for application/json to return correct response