List of usage examples for org.apache.http.client.methods HttpGetHC4 setHeader
public void setHeader(String str, String str2)
From source file:at.bitfire.davdroid.webdav.DavHttpClientTest.java
public void testCookies() throws IOException { CloseableHttpResponse response = null; HttpGetHC4 get = new HttpGetHC4(testCookieURI); get.setHeader("Accept", "text/xml"); // at first, DavHttpClient doesn't send a cookie try {// w w w . ja v a 2 s .c o m response = httpClient.execute(get); assertEquals(412, response.getStatusLine().getStatusCode()); } finally { if (response != null) response.close(); } // POST sets a cookie to DavHttpClient try { response = httpClient.execute(new HttpPostHC4(testCookieURI)); assertEquals(200, response.getStatusLine().getStatusCode()); } finally { if (response != null) response.close(); } // and now DavHttpClient sends a cookie for GET, too try { response = httpClient.execute(get); assertEquals(200, response.getStatusLine().getStatusCode()); } finally { if (response != null) response.close(); } }