updated request middleware