ipfs-shipyard / gomobile-ipfs

IPFS and libp2p on Mobile, with Gomobile
Other
324 stars 63 forks source link

Java RequestBuilder.withBody(InputStream) EOF error #143

Closed jefft0 closed 1 year ago

jefft0 commented 2 years ago

Is there an existing issue for this?

Package version

v1.9.0

Language version and compiler version

go1.18.5, javac 11.0.12

Bug description

In Android Studio, open requestIPFSTests.java and run testAddWithStreamBody: https://github.com/jefft0/gomobile-ipfs/blob/Java-testAddWithBody/android/bridge/src/androidTest/java/ipfs/gomobile/android/requestIPFSTests.java#L144-L155

Current behavior

The test throws the following exception:

ipfs.gomobile.android.RequestBuilder$RequestBuilderException: Failed to send request
  at ipfs.gomobile.android.RequestBuilder.sendToBytes(RequestBuilder.java:68)
  at ipfs.gomobile.android.RequestBuilder.sendToJSONList(RequestBuilder.java:80)
  at ipfs.gomobile.android.requestIPFSTests.testAddWithStreamBody(requestIPFSTests.java:150)
  ...
  at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298)
  at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292)
  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  at java.lang.Thread.run(Thread.java:923)
Caused by: go.Universe$proxyerror: Post "http://unix/api/v0/add?": EOF
  at core.RequestBuilder.sendToBytes(Native Method)
  at ipfs.gomobile.android.RequestBuilder.sendToBytes(RequestBuilder.java:66)

Expected behavior

The test should pass, the same as the similar testAddWithBytesBody which uses withBody with a byte array instead of InputStream.

Environment

macOS 10.15

Other

No response