HttpUtils { public static Map<String, Cookie> parseCookieHeaderString(String header) { List<HttpCookie> list = HttpCookie.parse(header); Map<String, Cookie> map = new HashMap(list.size()); list.forEach((hc) -> { String name = hc.getName(); Cookie c = new Cookie(name, hc.getValue()); c.putIfValueNotNull(Cookie.DOMAIN, hc.getDomain()); c.putIfValueNotNull(Cookie.PATH, hc.getPath()); c.putIfValueNotNull(Cookie.VERSION, hc.getVersion() + ""); c.putIfValueNotNull(Cookie.MAX_AGE, hc.getMaxAge() + ""); c.putIfValueNotNull(Cookie.SECURE, hc.getSecure() + ""); map.put(name, c); }); return map; } private  HttpUtils(); static KeyStore getKeyStore(ScenarioContext context, String trustStoreFile, String password, String type); static boolean isPrintable(String mediaType); static Charset parseContentTypeCharset(String mimeType); static Map<String, String> parseContentTypeParams(String mimeType); static String getContentType(ScriptValue sv); static Map<String, Cookie> parseCookieHeaderString(String header); static String createCookieHeaderValue(Collection<Cookie> cookies); static Map<String, String> parseUriPattern(String pattern, String url); static final String normaliseUriPath(String uri); static List<Integer> calculatePathMatchScore(String path); static String generateMimeBoundaryMarker(); static String multiPartToString(List<MultiPartItem> items, String boundary); static final String HEADER_CONTENT_TYPE; static final String HEADER_CONTENT_LENGTH; static final String HEADER_ACCEPT; static final String HEADER_ALLOW; static final String HEADER_AC_ALLOW_ORIGIN; static final String HEADER_AC_ALLOW_METHODS; static final String HEADER_AC_REQUEST_HEADERS; static final String HEADER_AC_ALLOW_HEADERS; static final String CHARSET; static final Set<String> HTTP_METHODS; static final List<Integer> DEFAULT_PATH_SCORE; }
@Test public void testParseCookieString() { String header = "Set-Cookie: foo=\"bar\";Version=1"; Map<String, Cookie> map = HttpUtils.parseCookieHeaderString(header); Match.equals(map, "{ foo: '#object' }"); Match.contains(map.get("foo"), "{ name: 'foo', value: 'bar' }"); }