使用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"这种格式

猜你喜欢

转载自blog.csdn.net/sinat_24070543/article/details/82772064
今日推荐