shogun-relay-sdk 1.2.6 → 1.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/modules/ipfs.js +7 -2
- package/package.json +1 -1
package/dist/modules/ipfs.js
CHANGED
|
@@ -74,9 +74,14 @@ class IpfsModule {
|
|
|
74
74
|
const encodedPath = fullPath.includes('/')
|
|
75
75
|
? `${encodeURIComponent(directoryCid)}/${filePath.split('/').map(p => encodeURIComponent(p)).join('/')}`
|
|
76
76
|
: encodeURIComponent(fullPath);
|
|
77
|
-
|
|
77
|
+
// Use GET instead of POST, or send empty string instead of null to avoid JSON parser error
|
|
78
|
+
// IPFS API v0 cat accepts POST with empty body, but Express JSON parser fails on null
|
|
79
|
+
return this.client.post(`/api/v1/ipfs/api/v0/cat?arg=${encodedPath}`, "", // Empty string instead of null to avoid JSON parser error
|
|
80
|
+
{
|
|
78
81
|
responseType: "arraybuffer",
|
|
79
|
-
|
|
82
|
+
headers: {
|
|
83
|
+
"Content-Type": "application/octet-stream", // Set content type to avoid JSON parsing
|
|
84
|
+
},
|
|
80
85
|
});
|
|
81
86
|
}
|
|
82
87
|
async pinAdd(cid) {
|
package/package.json
CHANGED