obsidianmd/obsidian-api

Bug: requestURL when body is arraybinary or formdata, I try to transform formdata to array put it in body of request, but failed.

ai-chen2050 opened this issue · 6 comments

Steps to reproduce:

First

Second

I don't know why the server ip is not same when I use obsidian reqestUrl and python command line, here are some I debug info ( print info and wireshark info), it related the formdata and upload a image file to server (and material/add_material? interface), I handle my self in the obsidian, but I have been triple checked, and sure, they are same binary body in two method.

first, I try my best to make the body the same in two methods. but IP is not same in two methods. It's becouse DNS ? ? I don't know why.

  1. python shell command line, pass
requests.request("POST", url, headers=headers, data=payload, files=files)

python ok

  1. obsidian requestUrl, fail
    ob fail

  2. python wireshark, true data
    py

  3. obsidian requestUrl wireshark, not see true data
    ob

Three

I have try python code and nodejs request the interface upload a file all are oks. But using requestUrl in obsidian fail, some sourcecode in here.

requestUrl does not support FormData. You must supply the full http request body either as a string or as an ArrayBuffer. Unfortunately this does make it quite a bit tedious to work with multipart form data.

Thx, I fix this problem, just replace body: post_typedArray using body: post_typedArray.buffer.