patch middleware method to update context+