File tree Expand file tree Collapse file tree 1 file changed +3
-0
lines changed
src/main/java/com/microsoft/graph/core/requests/upload Expand file tree Collapse file tree 1 file changed +3
-0
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,9 @@ public <T extends Parsable> UploadResult<T> handleResponse(@Nonnull final Respon
5454 try (final ResponseBody body = response .body ()) {
5555 UploadResult <T > uploadResult = new UploadResult <>();
5656 String contentLengthHeader = response .headers ().get ("content-length" );
57+ // rely on content-type OR content-length headers to determine if response body is empty.
58+ // Response body() may be non-null despite being empty in raw response https://square.github.io/okhttp/3.x/okhttp/okhttp3/Response.html#body--
59+ // content-length header is not always present in Graph responses. Content-type is more reliable
5760 if (Objects .isNull (body )
5861 || Objects .isNull (body .contentType ())
5962 || (!Objects .isNull (contentLengthHeader ) && Integer .parseInt (contentLengthHeader ) == 0 )
You can’t perform that action at this time.
0 commit comments