There is a new reply, it seems to be an error reported by joplin
const path = resolve(__dirname, '../resource/resourcesByFileId.png')
function getFormData() {
const fd = new FormData()
const title = 'image title'
fd.append('props', JSON.stringify({ title: title }))
fd.append('data', readFileSync(path))
return fd
}
it('test create by axios', async () => {
const fd = getFormData()
const resp = await axios.post(
ApiUtil.baseUrl('/resources'),
fd.getBuffer(),
{
headers: fd.getHeaders(),
},
)
console.log('resp.data: ', resp.data)
})
Reproduce the code: joplin-api/test/api/ResourceApi.test.ts at 34f3b99ea6c97741e88fc964eed6a3eb5fa5ca55 · rxliuli/joplin-api · GitHub
ref: axios upload form-data error · Issue #3325 · axios/axios · GitHub