/** * Creates the response received from the target host. * * @param home Home host * @param dest Destination URL * @param rsp Response received from the target host * @return Response */ private Response response(final String home, final URI dest, final com.jcabi.http.Response rsp) { final Collection<String> hdrs = new LinkedList<String>(); hdrs.add(String.format("X-Takes-TkProxy: from %s to %s by %s", home, dest, this.label)); for (final Map.Entry<String, List<String>> entry : rsp.headers().entrySet()) { for (final String value : entry.getValue()) { final String val; if (TkProxy.isHost(entry.getKey())) { val = this.target.toString(); } else { val = value; } hdrs.add(String.format("%s: %s", entry.getKey(), val)); } } return new RsWithStatus( new RsWithBody(new RsWithHeaders(hdrs), rsp.binary()), rsp.status(), rsp.reason()); }