@Test public void filterHeaders() throws Exception { Iterable<Map.Entry<String, String>> originalHeaders = ImmutableMap.<String, String>builder() .put("a", "1") .put("b", "2") .put("c", "3") .build().entrySet(); HarResponseData responseData = HarResponseData.of(originalHeaders, null, null); HarResponseData transformed = responseData.transformer() .filterHeaders(header -> !"b".equalsIgnoreCase(header.getKey())) .transform(); assertEquals("a", "1", transformed.getFirstHeaderValue("a")); assertEquals("c", "3", transformed.getFirstHeaderValue("c")); assertNull("b", transformed.getFirstHeaderValue("b")); }
public HarResponseDataTransformer filterHeaders(Predicate<? super Map.Entry<String, String>> filter) { return headers(stream -> stream.filter(filter)); }
HarResponseDataTransformer { public HarResponseDataTransformer filterHeaders(Predicate<? super Map.Entry<String, String>> filter) { return headers(stream -> stream.filter(filter)); } }
HarResponseDataTransformer { public HarResponseDataTransformer filterHeaders(Predicate<? super Map.Entry<String, String>> filter) { return headers(stream -> stream.filter(filter)); } HarResponseDataTransformer(HarResponseData preTransformData); }
HarResponseDataTransformer { public HarResponseDataTransformer filterHeaders(Predicate<? super Map.Entry<String, String>> filter) { return headers(stream -> stream.filter(filter)); } HarResponseDataTransformer(HarResponseData preTransformData); HarResponseDataTransformer body(Function<ByteSource, ByteSource> bodyTransform); HarResponseDataTransformer contentType(Function<MediaType, MediaType> contentTypeSupplier); HarResponseDataTransformer headers(Function<Stream<Map.Entry<String, String>>, Stream<Map.Entry<String, String>>> headersTransform); HarResponseDataTransformer filterHeaders(Predicate<? super Map.Entry<String, String>> filter); HarResponseDataTransformer mapHeader(Function<Map.Entry<String, String>, Map.Entry<String, String>> map); HarResponseDataTransformer mapHeaderWithName(String headerName, Function<String, String> valueMap); HarResponseDataTransformer replaceHeader(String headerName, String newValue); HarResponseDataTransformer replaceContentType(MediaType contentType); HarResponseData transform(); }
HarResponseDataTransformer { public HarResponseDataTransformer filterHeaders(Predicate<? super Map.Entry<String, String>> filter) { return headers(stream -> stream.filter(filter)); } HarResponseDataTransformer(HarResponseData preTransformData); HarResponseDataTransformer body(Function<ByteSource, ByteSource> bodyTransform); HarResponseDataTransformer contentType(Function<MediaType, MediaType> contentTypeSupplier); HarResponseDataTransformer headers(Function<Stream<Map.Entry<String, String>>, Stream<Map.Entry<String, String>>> headersTransform); HarResponseDataTransformer filterHeaders(Predicate<? super Map.Entry<String, String>> filter); HarResponseDataTransformer mapHeader(Function<Map.Entry<String, String>, Map.Entry<String, String>> map); HarResponseDataTransformer mapHeaderWithName(String headerName, Function<String, String> valueMap); HarResponseDataTransformer replaceHeader(String headerName, String newValue); HarResponseDataTransformer replaceContentType(MediaType contentType); HarResponseData transform();  }