1. 程式人生 > >使用fetch遇到no multipart boundary was found的原因,以及三種content-type

使用fetch遇到no multipart boundary was found的原因,以及三種content-type

使用form-data來post內容的時候,提示這個錯誤,
使用form-data提交的時候,不要手動設定content-type,

chrome會自動生成content-type,
而且自動生成的content-type中會帶有自動生成boundary


另,

content-type為application/json的時候,
body的資料為json格式

還有一種content-type為application/x-www-form-urlencoded,
body的資料需要轉化成"a=123&b=456"這種格式