|
13 | 13 | */ |
14 | 14 | package feign.client; |
15 | 15 |
|
16 | | -import static org.assertj.core.api.Assertions.assertThat; |
17 | | -import static org.hamcrest.core.Is.isA; |
18 | | -import static org.junit.Assert.assertEquals; |
19 | | -import java.io.ByteArrayInputStream; |
20 | | -import java.io.ByteArrayOutputStream; |
| 16 | +import feign.Client; |
| 17 | +import feign.Client.Proxied; |
| 18 | +import feign.Feign; |
| 19 | +import feign.Feign.Builder; |
| 20 | +import feign.RetryableException; |
| 21 | +import feign.assertj.MockWebServerAssertions; |
| 22 | +import okhttp3.mockwebserver.MockResponse; |
| 23 | +import okhttp3.mockwebserver.SocketPolicy; |
| 24 | +import org.junit.Test; |
| 25 | +import javax.net.ssl.HostnameVerifier; |
| 26 | +import javax.net.ssl.SSLSession; |
21 | 27 | import java.io.IOException; |
22 | 28 | import java.net.HttpURLConnection; |
23 | 29 | import java.net.InetSocketAddress; |
|
26 | 32 | import java.net.Proxy.Type; |
27 | 33 | import java.net.SocketAddress; |
28 | 34 | import java.net.URL; |
29 | | -import java.nio.charset.StandardCharsets; |
30 | | -import java.util.zip.DeflaterOutputStream; |
31 | | -import java.util.zip.GZIPOutputStream; |
32 | | -import javax.net.ssl.HostnameVerifier; |
33 | | -import javax.net.ssl.SSLSession; |
34 | | -import okio.Buffer; |
35 | | -import org.junit.Test; |
36 | | -import feign.Client; |
37 | | -import feign.Client.Proxied; |
38 | | -import feign.Feign; |
39 | | -import feign.Feign.Builder; |
40 | | -import feign.RetryableException; |
41 | | -import okhttp3.mockwebserver.MockResponse; |
42 | | -import okhttp3.mockwebserver.SocketPolicy; |
| 35 | +import java.util.Collections; |
| 36 | +import static org.assertj.core.api.Assertions.assertThat; |
| 37 | +import static org.assertj.core.api.Assertions.entry; |
| 38 | +import static org.hamcrest.core.Is.isA; |
| 39 | +import static org.junit.Assert.assertEquals; |
43 | 40 |
|
44 | 41 | /** |
45 | 42 | * Tests client-specific behavior, such as ensuring Content-Length is sent when specified. |
@@ -97,6 +94,22 @@ public void testPatch() throws Exception { |
97 | 94 | super.testPatch(); |
98 | 95 | } |
99 | 96 |
|
| 97 | + @Override |
| 98 | + public void noResponseBodyForPost() throws Exception { |
| 99 | + super.noResponseBodyForPost(); |
| 100 | + MockWebServerAssertions.assertThat(server.takeRequest()) |
| 101 | + .hasMethod("POST") |
| 102 | + .hasHeaders(entry("Content-Length", Collections.singletonList("0"))); |
| 103 | + } |
| 104 | + |
| 105 | + @Override |
| 106 | + public void noResponseBodyForPut() throws Exception { |
| 107 | + super.noResponseBodyForPut(); |
| 108 | + MockWebServerAssertions.assertThat(server.takeRequest()) |
| 109 | + .hasMethod("PUT") |
| 110 | + .hasHeaders(entry("Content-Length", Collections.singletonList("0"))); |
| 111 | + } |
| 112 | + |
100 | 113 | @Test |
101 | 114 | @Override |
102 | 115 | public void noResponseBodyForPatch() { |
|
0 commit comments