@Test public void replaceContentLengthHeaderValue_removeMultiple() throws Exception { checkState("content-length".equalsIgnoreCase(HttpHeaders.CONTENT_LENGTH)); Multimap<String, String> headers = ArrayListMultimap.create(); headers.put("content-length", "100"); headers.put("Content-Length", "150"); headers.put("Content-Type", "application/octet-stream"); HarBridgeEntryParser.replaceContentLength(headers, null); assertEquals("headers remaining", ImmutableMultimap.of("Content-Type", "application/octet-stream"), headers); }
protected static void replaceContentLength(Multimap<String, String> headers, @Nullable Long value) { @Nullable String valueStr = value == null ? null : value.toString(); replaceHeaders(headers, HttpHeaders.CONTENT_LENGTH, valueStr); }
HarBridgeEntryParser implements EntryParser<E> { protected static void replaceContentLength(Multimap<String, String> headers, @Nullable Long value) { @Nullable String valueStr = value == null ? null : value.toString(); replaceHeaders(headers, HttpHeaders.CONTENT_LENGTH, valueStr); } }
HarBridgeEntryParser implements EntryParser<E> { protected static void replaceContentLength(Multimap<String, String> headers, @Nullable Long value) { @Nullable String valueStr = value == null ? null : value.toString(); replaceHeaders(headers, HttpHeaders.CONTENT_LENGTH, valueStr); } HarBridgeEntryParser(HarBridge<E> bridge, HarResponseEncoderFactory<E> responseEncoderFactory); }
HarBridgeEntryParser implements EntryParser<E> { protected static void replaceContentLength(Multimap<String, String> headers, @Nullable Long value) { @Nullable String valueStr = value == null ? null : value.toString(); replaceHeaders(headers, HttpHeaders.CONTENT_LENGTH, valueStr); } HarBridgeEntryParser(HarBridge<E> bridge, HarResponseEncoderFactory<E> responseEncoderFactory); static HarBridgeEntryParser<E> withPlainEncoder(HarBridge<E> bridge); @Override ParsedRequest parseRequest(E harEntry); @Nullable Multimap<String, Optional<String>> parseQuery(URI uri); @Override HttpRespondable parseResponse(ParsedRequest request, E entry); }
HarBridgeEntryParser implements EntryParser<E> { protected static void replaceContentLength(Multimap<String, String> headers, @Nullable Long value) { @Nullable String valueStr = value == null ? null : value.toString(); replaceHeaders(headers, HttpHeaders.CONTENT_LENGTH, valueStr); } HarBridgeEntryParser(HarBridge<E> bridge, HarResponseEncoderFactory<E> responseEncoderFactory); static HarBridgeEntryParser<E> withPlainEncoder(HarBridge<E> bridge); @Override ParsedRequest parseRequest(E harEntry); @Nullable Multimap<String, Optional<String>> parseQuery(URI uri); @Override HttpRespondable parseResponse(ParsedRequest request, E entry);  }