HTTPCLIENT-1199: Added unit test to verify Oleg's recent fix.
We still do not properly handle the redirect case, however. git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1345217 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f785d0ed7a
commit
2451e5dec7
|
@ -36,6 +36,7 @@ import java.util.zip.GZIPOutputStream;
|
|||
import org.apache.http.Header;
|
||||
import org.apache.http.HeaderElement;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpEntityEnclosingRequest;
|
||||
import org.apache.http.HttpHost;
|
||||
import org.apache.http.HttpRequest;
|
||||
import org.apache.http.HttpResponse;
|
||||
|
@ -44,6 +45,7 @@ import org.apache.http.HttpVersion;
|
|||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.ResponseHandler;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.client.methods.HttpUriRequest;
|
||||
import org.apache.http.conn.ClientConnectionManager;
|
||||
import org.apache.http.entity.ByteArrayEntity;
|
||||
|
@ -334,6 +336,15 @@ public class TestDecompressingHttpClient {
|
|||
assertNotNull(result.getFirstHeader("Content-MD5"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void passesThroughTheBodyOfAPOST() throws Exception {
|
||||
when(mockHandler.handleResponse(isA(HttpResponse.class))).thenReturn(new Object());
|
||||
HttpPost post = new HttpPost("http://localhost:8080/");
|
||||
post.setEntity(new ByteArrayEntity("hello".getBytes()));
|
||||
impl.execute(host, post, mockHandler, ctx);
|
||||
assertNotNull(((HttpEntityEnclosingRequest)backend.getCapturedRequest()).getEntity());
|
||||
}
|
||||
|
||||
private HttpResponse getGzippedResponse(final String plainText)
|
||||
throws IOException {
|
||||
HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_1, HttpStatus.SC_OK, "OK");
|
||||
|
|
Loading…
Reference in New Issue