"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "httpclient/src/test/java/org/apache/http/impl/client/TestDefaultRedirectStrategy.java" between
httpcomponents-client-4.5.7-src.tar.gz and httpcomponents-client-4.5.8-src.tar.gz

About: HttpComponents is an Apache project responsible for creating and maintaining a toolset of low level Java components focused on HTTP and associated protocols. Java sources.

TestDefaultRedirectStrategy.java  (httpcomponents-client-4.5.7-src):TestDefaultRedirectStrategy.java  (httpcomponents-client-4.5.8-src)
skipping to change at line 388 skipping to change at line 388
final HttpPost httppost = new HttpPost("http://localhost/"); final HttpPost httppost = new HttpPost("http://localhost/");
final HttpEntity entity = new BasicHttpEntity(); final HttpEntity entity = new BasicHttpEntity();
httppost.setEntity(entity); httppost.setEntity(entity);
final HttpUriRequest redirect2 = redirectStrategy.getRedirect( final HttpUriRequest redirect2 = redirectStrategy.getRedirect(
httppost, response, context2); httppost, response, context2);
Assert.assertEquals("POST", redirect2.getMethod()); Assert.assertEquals("POST", redirect2.getMethod());
Assert.assertTrue(redirect2 instanceof HttpEntityEnclosingRequest); Assert.assertTrue(redirect2 instanceof HttpEntityEnclosingRequest);
Assert.assertSame(entity, ((HttpEntityEnclosingRequest) redirect2).getEn tity()); Assert.assertSame(entity, ((HttpEntityEnclosingRequest) redirect2).getEn tity());
} }
@Test
public void testCreateLocationURI() throws Exception {
final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStra
tegy();
Assert.assertEquals("http://blahblah/",
redirectStrategy.createLocationURI("http://BlahBlah").toASCIIStr
ing());
}
@Test(expected=ProtocolException.class) @Test(expected=ProtocolException.class)
public void testCreateLocationURIInvalid() throws Exception { public void testCreateLocationURIInvalid() throws Exception {
final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStra tegy(); final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStra tegy();
redirectStrategy.createLocationURI(":::::::"); redirectStrategy.createLocationURI(":::::::");
} }
@Test
public void testWithoutNormalize() throws Exception {
final DefaultRedirectStrategy redirectStrategy = new DefaultRedirectStra
tegy();
final HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1
,
HttpStatus.SC_TEMPORARY_REDIRECT, "Temporary Redirect");
response.addHeader("Location", "http://somewhere.com//foo");
final HttpClientContext context1 = new HttpClientContext(new BasicHttpCo
ntext());
context1.setRequestConfig(RequestConfig.custom().setNormalizeUri(false).
build());
Assert.assertEquals("http://somewhere.com//foo", redirectStrategy.getRed
irect(
new HttpGet("http://localhost/stuff"), response, context1).getURI().
toASCIIString());
}
} }
 End of changes. 2 change blocks. 
9 lines changed or deleted 17 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)