|
1 | 1 | /*
|
2 |
| - * Copyright 2023-2023 the original author or authors. |
| 2 | + * Copyright 2002-2023 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
24 | 24 | import org.junit.jupiter.api.Test;
|
25 | 25 |
|
26 | 26 | import org.springframework.http.HttpMethod;
|
| 27 | +import org.springframework.http.HttpStatus; |
27 | 28 | import org.springframework.http.HttpStatusCode;
|
28 | 29 | import org.springframework.lang.Nullable;
|
29 | 30 |
|
@@ -67,12 +68,22 @@ public void httpMethods() throws Exception {
|
67 | 68 |
|
68 | 69 | @Test
|
69 | 70 | public void customizeDisallowedHeaders() throws IOException {
|
70 |
| - ClientHttpRequest request = factory.createRequest(URI.create(this.baseUrl + "/status/299"), HttpMethod.PUT); |
| 71 | + ClientHttpRequest request = this.factory.createRequest(URI.create(this.baseUrl + "/status/299"), HttpMethod.PUT); |
71 | 72 | request.getHeaders().set("Expect", "299");
|
72 | 73 |
|
73 | 74 | try (ClientHttpResponse response = request.execute()) {
|
74 | 75 | assertThat(response.getStatusCode()).as("Invalid status code").isEqualTo(HttpStatusCode.valueOf(299));
|
75 | 76 | }
|
76 | 77 | }
|
77 | 78 |
|
| 79 | + @Test // gh-31451 |
| 80 | + public void contentLength0() throws IOException { |
| 81 | + BufferingClientHttpRequestFactory bufferingFactory = new BufferingClientHttpRequestFactory(this.factory); |
| 82 | + ClientHttpRequest request = bufferingFactory.createRequest(URI.create(this.baseUrl + "/methods/get"), HttpMethod.GET); |
| 83 | + |
| 84 | + try (ClientHttpResponse response = request.execute()) { |
| 85 | + assertThat(response.getStatusCode()).as("Invalid response status").isEqualTo(HttpStatus.OK); |
| 86 | + } |
| 87 | + } |
| 88 | + |
78 | 89 | }
|
0 commit comments