Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
public class DisconnectedClientHelper {

private static final Set<String> EXCEPTION_PHRASES =
Set.of("broken pipe", "connection reset by peer");
Set.of("broken pipe", "connection reset by peer",
"response may not be written");

private static final Set<String> EXCEPTION_TYPE_NAMES =
Set.of("AbortedException", "ClientAbortException",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import org.springframework.web.client.ResourceAccessException;
import org.springframework.web.context.request.async.AsyncRequestNotUsableException;
import org.springframework.web.testfixture.http.MockHttpInputMessage;
import org.springframework.http.converter.HttpMessageNotWritableException;

import static org.assertj.core.api.Assertions.assertThat;

Expand Down Expand Up @@ -99,4 +100,11 @@ void nullException() {
assertThat(DisconnectedClientHelper.isClientDisconnectedException(null)).isFalse();
}

@Test // gh-36421
void httpMessageNotWritableFromClosedConnection() {
IOException cause = new IOException("The response may not be written to once it has been closed");
Exception ex = new HttpMessageNotWritableException("Could not write JSON", cause);
assertThat(DisconnectedClientHelper.isClientDisconnectedException(ex)).isTrue();
}

}