Skip to content

Commit 6799a85

Browse files
committed
another fix
1 parent d780200 commit 6799a85

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

test/framework/src/main/java/org/elasticsearch/test/rest/FakeRestRequest.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,11 @@ public void setContentLength(int contentLength) {
126126
}
127127

128128
public void setContentLength(HttpBody body) {
129-
if (body.isEmpty() || body instanceof HttpBody.NoopStream) {
130-
setContentLength(0);
131-
} else if (body.isFull()) {
132-
setContentLength(body.asFull().bytes().length());
129+
if (body.isFull()) {
130+
var len = body.asFull().bytes().length();
131+
if (len > 0) {
132+
setContentLength(body.asFull().bytes().length());
133+
}
133134
}
134135
}
135136

0 commit comments

Comments
 (0)