16
16
17
17
package org .springframework .http .client ;
18
18
19
- import java .io .InputStreamReader ;
20
19
import java .net .URI ;
21
20
import java .nio .charset .StandardCharsets ;
22
21
import java .util .Arrays ;
@@ -50,7 +49,12 @@ void repeatableRead() throws Exception {
50
49
FileCopyUtils .copy (body , request .getBody ());
51
50
try (ClientHttpResponse response = request .execute ()) {
52
51
assertThat (response .getStatusCode ()).as ("Invalid status code" ).isEqualTo (HttpStatus .OK );
52
+ assertThat (response .getStatusCode ()).as ("Invalid status code" ).isEqualTo (HttpStatus .OK );
53
+
54
+ assertThat (response .getHeaders ().containsKey (headerName )).as ("Header not found" ).isTrue ();
53
55
assertThat (response .getHeaders ().containsKey (headerName )).as ("Header not found" ).isTrue ();
56
+
57
+ assertThat (response .getHeaders ().get (headerName )).as ("Header value not found" ).isEqualTo (Arrays .asList (headerValue1 , headerValue2 ));
54
58
assertThat (response .getHeaders ().get (headerName )).as ("Header value not found" ).isEqualTo (Arrays .asList (headerValue1 , headerValue2 ));
55
59
56
60
byte [] result = FileCopyUtils .copyToByteArray (response .getBody ());
@@ -60,14 +64,4 @@ void repeatableRead() throws Exception {
60
64
}
61
65
}
62
66
63
- @ Test
64
- void shouldNotSetContentLengthWhenEmptyBody () throws Exception {
65
- ClientHttpRequest request = factory .createRequest (URI .create (baseUrl + "/header/Content-Length" ), HttpMethod .POST );
66
- try (ClientHttpResponse response = request .execute ()) {
67
- assertThat (response .getStatusCode ()).as ("Invalid status code" ).isEqualTo (HttpStatus .OK );
68
- String result = FileCopyUtils .copyToString (new InputStreamReader (response .getBody ()));
69
- assertThat (result ).as ("Invalid body" ).isEqualTo ("Content-Length:null" );
70
- }
71
- }
72
-
73
67
}
0 commit comments