Skip to content

Commit bba70e7

Browse files
author
Nakul Sabharwal
committed
check for empty error response
1 parent 7253bd9 commit bba70e7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/com/microsoft/graph/http/GraphServiceException.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,10 @@ public static <T> GraphServiceException createFromConnection(final IHttpRequest
415415
}
416416

417417
final String responseMessage = response.message();
418-
final String rawOutput = DefaultHttpProvider.streamToString(response.body().byteStream());
418+
String rawOutput = "{}";
419+
if(response.body().byteStream() != null) {
420+
rawOutput = DefaultHttpProvider.streamToString(response.body().byteStream());
421+
}
419422
GraphErrorResponse error;
420423
try {
421424
error = serializer.deserializeObject(rawOutput, GraphErrorResponse.class, OkHttpProvider.getResponseHeadersAsMapOfStringList(response));

0 commit comments

Comments
 (0)