@Override
    public HttpRequestMessage apply(HttpRequestMessage request) {
        SessionContext ctx = request.getContext();

        Debug.addRequestDebug(
                ctx,
                "REQUEST:: " + request.getOriginalScheme() + " " + request.getOriginalHost() + ":"
                        + request.getOriginalPort());

        Debug.addRequestDebug(
                ctx,
                "REQUEST:: > " + request.getMethod() + " " + request.reconstructURI() + " " + request.getProtocol());

        for (Header header : request.getHeaders().entries()) {
            Debug.addRequestDebug(ctx, "REQUEST:: > " + header.getName() + ":" + header.getValue());
        }

        if (request.hasBody()) {
            Debug.addRequestDebug(ctx, "REQUEST:: > " + request.getBodyAsText());
        }

        return request;
    }
Add debug request info to the context if request is marked as debug.

Author: Arthur Gonigberg
Date: December 22, 2017
zuul-sample/src/main/java/com/netflix/zuul/sample/filters/inbound/DebugRequest.java