ipfs-shipyard / java-ipfs-http-client

A Java implementation of the HTTP IPFS API
MIT License
538 stars 243 forks source link

Modify configureConnection to POST only #161

Closed MangKyu closed 4 years ago

MangKyu commented 4 years ago

IPFS method does not support GET Method. When i tried to initialize IPFS Object, it occurs an error like below

Exception in thread "main" java.lang.RuntimeException: IOException contacting IPFS daemon. Trailer: null 405 - Method Not Allowed

at io.ipfs.api.IPFS.get(IPFS.java:683)
at io.ipfs.api.IPFS.retrieve(IPFS.java:662)
at io.ipfs.api.IPFS.retrieveAndParse(IPFS.java:624)
at io.ipfs.api.IPFS.version(IPFS.java:572)
at io.ipfs.api.IPFS.<init>(IPFS.java:69)
at io.ipfs.api.IPFS.<init>(IPFS.java:45)
at Main.main(Main.java:15)

Caused by: java.io.IOException: Server returned HTTP response code: 405 for URL: http://127.0.0.1:5001/api/v0/version at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1900) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1498) at io.ipfs.api.IPFS.get(IPFS.java:671) ... 6 more

So We have to modify all request to POST only

odisseus commented 4 years ago

These changes are equivalent to those I proposed in #159. I wonder if the maintainers of this project are going to merge either pull request...

lidel commented 4 years ago

Thank you! We need to fix multiple issues at the same time, so I reused your changes from this PR and opened https://github.com/ipfs-shipyard/java-ipfs-http-client/pull/164 – lets continue there.