Allow on_response to accept both request and response objects.