Skip to content

GraphClient.customRequest returns a BufferedInputStream instead of a Stream #331

@jmcazaux

Description

@jmcazaux

Expected behavior

When called with a Stream.class as second parameter, GraphClient.customRequest should return a Stream.

Actual behavior

GraphClient.customRequest returns a java.io.BufferedInputStream that causes a ClassCastException

Steps to reproduce the behavior

Use the very same code that is shown in the documentation.

        String contentRequest = String.format(
                "/drives/%s/items/%s/content",
                DRIVE_ID,
                ITEM_ID
        );

        Stream stream = graphClient.customRequest(contentRequest, Stream.class)
                .buildRequest()
                .get();

When executing this code, I am getting a ClassCastException.

Exception in thread "main" java.lang.ClassCastException: java.io.BufferedInputStream cannot be cast to java.util.stream.Stream
	at com.acmeinc.msgraph.TestSharepointAccess.getFile(TestSharepointAccess.java:249)
	at com.acmeinc.msgraph.TestSharepointAccess.testSharepoint(TestSharepointAccess.java:90)
	at Main.main(Main.java:27)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions