Replace response_mode=form handling by a more robust solution