return new HttpTestClient(baseUrl, principal,
ImmutableMap.<String,String>builder().putAll(cookies).put(cookieName, cookieValue).build());
}
public HttpRequest http(String method, String url) {
HttpRequest httpRequest = new HttpRequest(baseUrl + root(url), method)
.header("RestxThreadLocal", Factory.LocalMachines.threadLocal().getId())
.header("RestxBlade", Blade.current())
;
if (!cookies.isEmpty()) {
StringBuilder sb = new StringBuilder();
for (Map.Entry<String, String> entry : cookies.entrySet()) {
sb.append(entry.getKey()).append("=\"").append(entry.getValue().replace("\"", "\\\"")).append("\"; ");
}
sb.setLength(sb.length() - 2);
httpRequest.header("Cookie", sb.toString());
}
return httpRequest;
}