Ah sorry, I should have checked util.py, I thought request_wants_json was a new method while in fact it already exists.