Motivation

When I read Stream.peek() in java 8 document, It was for debugging. and Stream.peek() has side effect in Java 9. so I updated it with Stream.map

Modification

Update Stream.peek() -> Stream.map()

Reference

Java8 API Note: This method exists mainly to support debugging, where you want to see the elements as they flow past a certain point in a pipeline:

Java 9 Issue - Java9 Stream Count - Peek Issue

Comment From: rstoyanchev

Thanks for the PR but the Javadoc you're referring to is for Stream#count which is not in use here. Using Java 11 I confirmed the code works as expected.

Also keep in mind this code is in support of ForwardedHeaderFilter which is deprecated since 5.1, and will likely be removed in 5.3.