mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-09-26 17:09:05 +00:00
Fixed problem when headers were written after ClientHttpRequest.execute()
git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@666 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
+19
@@ -99,6 +99,25 @@ public abstract class AbstractHttpRequestFactoryTestCase {
|
||||
assertTrue("Invalid body", Arrays.equals(body, result));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalStateException.class)
|
||||
public void multipleWrites() throws Exception {
|
||||
ClientHttpRequest request = factory.createRequest(new URI("http://localhost:8889/echo"), HttpMethod.POST);
|
||||
byte[] body = "Hello World".getBytes("UTF-8");
|
||||
FileCopyUtils.copy(body, request.getBody());
|
||||
request.execute();
|
||||
FileCopyUtils.copy(body, request.getBody());
|
||||
}
|
||||
|
||||
@Test(expected = IllegalStateException.class)
|
||||
public void headersAfterExecute() throws Exception {
|
||||
ClientHttpRequest request = factory.createRequest(new URI("http://localhost:8889/echo"), HttpMethod.POST);
|
||||
request.getHeaders().add("MyHeader", "value");
|
||||
byte[] body = "Hello World".getBytes("UTF-8");
|
||||
FileCopyUtils.copy(body, request.getBody());
|
||||
request.execute();
|
||||
request.getHeaders().add("MyHeader", "value");
|
||||
}
|
||||
|
||||
/**
|
||||
* Servlet that returns and error message for a given status code.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user