@Test public void getResponseData() throws Exception { ParsedRequest request = ParsedRequest.inMemory(io.github.mike10004.vhs.harbridge.HttpMethod.GET, URI.create("http: HarResponseData responseData = bridge.getResponseData(request, entry, HarResponseEncoding.unencoded()); assertEquals("body size", responseBody.length, responseData.getBody().size()); assertEquals("content type", contentType, responseData.getContentType()); assertEquals("number of headers", entry.getResponse().getHeaders().size(), (responseData.headers()).size()); }
@Override public HarResponseData getResponseData(ParsedRequest request, HarEntry entry, HarResponseEncoding encoding) throws IOException { TypedContent contentPackage = getResponseBody(entry); List<Map.Entry<String, String>> headers = getResponseHeaders(entry); HarResponseData underlying = HarResponseData.of(headers, contentPackage.getContentType(), contentPackage.asByteSource()); underlying = underlying.transformer() .replaceContentType(contentPackage.getContentType()) .replaceHeader(HttpHeaders.CONTENT_ENCODING, HttpContentCodecs.CONTENT_ENCODING_IDENTITY) .transform(); return encoding.transformUnencoded(underlying); }
SstoehrHarBridge implements HarBridge<HarEntry> { @Override public HarResponseData getResponseData(ParsedRequest request, HarEntry entry, HarResponseEncoding encoding) throws IOException { TypedContent contentPackage = getResponseBody(entry); List<Map.Entry<String, String>> headers = getResponseHeaders(entry); HarResponseData underlying = HarResponseData.of(headers, contentPackage.getContentType(), contentPackage.asByteSource()); underlying = underlying.transformer() .replaceContentType(contentPackage.getContentType()) .replaceHeader(HttpHeaders.CONTENT_ENCODING, HttpContentCodecs.CONTENT_ENCODING_IDENTITY) .transform(); return encoding.transformUnencoded(underlying); } }
SstoehrHarBridge implements HarBridge<HarEntry> { @Override public HarResponseData getResponseData(ParsedRequest request, HarEntry entry, HarResponseEncoding encoding) throws IOException { TypedContent contentPackage = getResponseBody(entry); List<Map.Entry<String, String>> headers = getResponseHeaders(entry); HarResponseData underlying = HarResponseData.of(headers, contentPackage.getContentType(), contentPackage.asByteSource()); underlying = underlying.transformer() .replaceContentType(contentPackage.getContentType()) .replaceHeader(HttpHeaders.CONTENT_ENCODING, HttpContentCodecs.CONTENT_ENCODING_IDENTITY) .transform(); return encoding.transformUnencoded(underlying); } SstoehrHarBridge();  SstoehrHarBridge(Charset exMachinaCharset); }
SstoehrHarBridge implements HarBridge<HarEntry> { @Override public HarResponseData getResponseData(ParsedRequest request, HarEntry entry, HarResponseEncoding encoding) throws IOException { TypedContent contentPackage = getResponseBody(entry); List<Map.Entry<String, String>> headers = getResponseHeaders(entry); HarResponseData underlying = HarResponseData.of(headers, contentPackage.getContentType(), contentPackage.asByteSource()); underlying = underlying.transformer() .replaceContentType(contentPackage.getContentType()) .replaceHeader(HttpHeaders.CONTENT_ENCODING, HttpContentCodecs.CONTENT_ENCODING_IDENTITY) .transform(); return encoding.transformUnencoded(underlying); } SstoehrHarBridge();  SstoehrHarBridge(Charset exMachinaCharset); @Override String getRequestMethod(HarEntry entry); @Override String getRequestUrl(HarEntry entry); @Override Stream<Map.Entry<String, String>> getRequestHeaders(HarEntry entry); @Nullable @Override ByteSource getRequestPostData(HarEntry entry); @Override HarResponseData getResponseData(ParsedRequest request, HarEntry entry, HarResponseEncoding encoding); @Override int getResponseStatus(HarEntry entry); }
SstoehrHarBridge implements HarBridge<HarEntry> { @Override public HarResponseData getResponseData(ParsedRequest request, HarEntry entry, HarResponseEncoding encoding) throws IOException { TypedContent contentPackage = getResponseBody(entry); List<Map.Entry<String, String>> headers = getResponseHeaders(entry); HarResponseData underlying = HarResponseData.of(headers, contentPackage.getContentType(), contentPackage.asByteSource()); underlying = underlying.transformer() .replaceContentType(contentPackage.getContentType()) .replaceHeader(HttpHeaders.CONTENT_ENCODING, HttpContentCodecs.CONTENT_ENCODING_IDENTITY) .transform(); return encoding.transformUnencoded(underlying); } SstoehrHarBridge();  SstoehrHarBridge(Charset exMachinaCharset); @Override String getRequestMethod(HarEntry entry); @Override String getRequestUrl(HarEntry entry); @Override Stream<Map.Entry<String, String>> getRequestHeaders(HarEntry entry); @Nullable @Override ByteSource getRequestPostData(HarEntry entry); @Override HarResponseData getResponseData(ParsedRequest request, HarEntry entry, HarResponseEncoding encoding); @Override int getResponseStatus(HarEntry entry); static final Charset DEFAULT_EX_MACHINA_CHARSET; }