Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
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
9 changes: 7 additions & 2 deletions 9 src/main/java/com/microsoft/graph/http/CoreHttpProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,13 @@ public MediaType contentType() {
} else {
logger.logDebug("Response binary");
isBinaryStreamInput = true;
//no inspection unchecked
return (Result) handleBinaryStream(in);
if (resultClass == InputStream.class) {
return (Result) handleBinaryStream(in);
} else if(response.body() != null && response.body().contentLength() > 0) { // some services reply in text/plain with a JSON representation...
return handleJsonResponse(in, CoreHttpProvider.getResponseHeadersAsMapOfStringList(response), resultClass);
} else {
return (Result) null;
}
}
} finally {
if (!isBinaryStreamInput) {
Expand Down
10 changes: 10 additions & 0 deletions 10 src/test/java/com/microsoft/graph/functional/UserTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import static org.junit.Assert.assertNotNull;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.List;

Expand All @@ -12,6 +14,7 @@
import com.microsoft.graph.models.extensions.Drive;
import com.microsoft.graph.models.extensions.DriveItem;
import com.microsoft.graph.models.extensions.IGraphServiceClient;
import com.microsoft.graph.models.extensions.ProfilePhoto;
import com.microsoft.graph.models.extensions.User;
import com.microsoft.graph.requests.extensions.IContactCollectionPage;
import com.microsoft.graph.requests.extensions.IDirectoryObjectCollectionWithReferencesPage;
Expand Down Expand Up @@ -122,6 +125,13 @@ public void usersKeyPhotoValueTest() {
}
}

@Test
public void updateUserPhotoValueTest() throws Exception {
final File photo = new File("src/test/resources/hamilton.jpg");
final InputStream fileStream = new FileInputStream(photo);
graphServiceClient.me().photo().content().buildRequest().put(OutlookTests.getByteArray(fileStream));
}

@Test
public void getOrganization() {
//GET organization
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.