Skip to content
Merged
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 @@ -344,7 +344,9 @@ private void setResponseType(final Object result, final Span span) {
}

private void closeResponse(boolean closeResponse, Response response) {
if (closeResponse && response.code() != 204) {
if (closeResponse
&& response.code() != 204
&& (response.code() < 300 || response.code() > 399)) {
response.close();
}
}
Expand Down Expand Up @@ -614,7 +616,7 @@ private void closeResponse(boolean closeResponse, Response response) {

private boolean shouldReturnNull(final Response response) {
final int statusCode = response.code();
return statusCode == 204;
return statusCode == 204 || (statusCode > 299 && statusCode < 400);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ void sendStreamReturnsUsableStream(int statusCode) throws Exception {
}

@ParameterizedTest
@ValueSource(ints = {200, 201, 202, 203, 204})
@ValueSource(ints = {200, 201, 202, 203, 204, 304})
void sendStreamReturnsNullOnNoContent(int statusCode) throws Exception {
final var authenticationProviderMock = mock(AuthenticationProvider.class);
authenticationProviderMock.authenticateRequest(
Expand Down Expand Up @@ -149,7 +149,7 @@ void sendStreamReturnsNullOnNoContent(int statusCode) throws Exception {
}

@ParameterizedTest
@ValueSource(ints = {200, 201, 202, 203, 204, 205})
@ValueSource(ints = {200, 201, 202, 203, 204, 205, 304})
void sendReturnsNullOnNoContent(int statusCode) throws Exception {
final var authenticationProviderMock = mock(AuthenticationProvider.class);
authenticationProviderMock.authenticateRequest(
Expand Down