Created
June 21, 2016 17:32
-
-
Save InputNeuron/b5d242e5cbdf55442d6e063ff935bc71 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ResponseDescriptor responseDescriptor | |
| = new ResponseDescriptor.Builder() | |
| .withStatus(301) | |
| .withHeader("Location", "http://httpbin.org/cookies/set?cat=dog") | |
| .build(); | |
| String url = String.format( "http://localhost.localdomain:%s/evaluate?response=%s", webserverPort.getPort(), responseDescriptor.toParam() ); | |
| HttpRequest httpRequest | |
| = httpRequestBuilder | |
| .get(url) | |
| .withCookie(new Cookie.Builder("foo", "bar") | |
| .setDomain("localhost.localdomain") | |
| .build()) | |
| .withCookie(new Cookie.Builder("cat", "dog") | |
| .setDomain("httpbin.org") | |
| .build()) | |
| .execute() | |
| .connect(); | |
| assertEquals("[Cookie{name='foo', value='bar', path=Optional[/], domain=Optional[localhost.localdomain], httpOnly=true, secure=false, maxAge=Optional[-1]}, Cookie{name='cat', value='dog', path=Optional[/], domain=Optional[httpbin.org], httpOnly=true, secure=false, maxAge=Optional[-1]}]", | |
| httpRequest.getEffectiveCookies().toString()); | |
| assertEquals("{\n" + | |
| " \"cookies\": {\n" + | |
| " \"cat\": \"dog\"\n" + | |
| " }\n" + | |
| "}\n", | |
| httpRequest.getContentWithEncoding()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment