File tree Expand file tree Collapse file tree 2 files changed +17
-2
lines changed
main/java/com/microsoft/graph/http
test/java/com/microsoft/graph/functional Expand file tree Collapse file tree 2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -398,8 +398,13 @@ public MediaType contentType() {
398398 } else {
399399 logger .logDebug ("Response binary" );
400400 isBinaryStreamInput = true ;
401- //no inspection unchecked
402- return (Result ) handleBinaryStream (in );
401+ if (resultClass == InputStream .class ) {
402+ return (Result ) handleBinaryStream (in );
403+ } else if (response .body () != null && response .body ().contentLength () > 0 ) { // some services reply in text/plain with a JSON representation...
404+ return handleJsonResponse (in , CoreHttpProvider .getResponseHeadersAsMapOfStringList (response ), resultClass );
405+ } else {
406+ return (Result ) null ;
407+ }
403408 }
404409 } finally {
405410 if (!isBinaryStreamInput ) {
Original file line number Diff line number Diff line change 22
33import static org .junit .Assert .assertNotNull ;
44
5+ import java .io .File ;
6+ import java .io .FileInputStream ;
57import java .io .InputStream ;
68import java .util .List ;
79
1214import com .microsoft .graph .models .extensions .Drive ;
1315import com .microsoft .graph .models .extensions .DriveItem ;
1416import com .microsoft .graph .models .extensions .IGraphServiceClient ;
17+ import com .microsoft .graph .models .extensions .ProfilePhoto ;
1518import com .microsoft .graph .models .extensions .User ;
1619import com .microsoft .graph .requests .extensions .IContactCollectionPage ;
1720import com .microsoft .graph .requests .extensions .IDirectoryObjectCollectionWithReferencesPage ;
@@ -122,6 +125,13 @@ public void usersKeyPhotoValueTest() {
122125 }
123126 }
124127
128+ @ Test
129+ public void updateUserPhotoValueTest () throws Exception {
130+ final File photo = new File ("src/test/resources/hamilton.jpg" );
131+ final InputStream fileStream = new FileInputStream (photo );
132+ graphServiceClient .me ().photo ().content ().buildRequest ().put (OutlookTests .getByteArray (fileStream ));
133+ }
134+
125135 @ Test
126136 public void getOrganization () {
127137 //GET organization
You can’t perform that action at this time.
0 commit comments