urlsearchparams专题

pnpm install报错 Value of “this“ must be of type URLSearchParams

执行pnpm install的时候就报错Value of “this” must be of type URLSearchParams 由于之前执行没有出现过这个问题,最近在使用vue3所以使用了高版本的node,怀疑是node版本的问题。 解决: 检查node版本 node -v 当前使用的是20.11.0的 修改为14.21.3后问题解决了

axios请求header中content-type设置和URLSearchParams参数

最近看了看axios的源码,对于其使用有了进一步了解,特别是配置header的 content-type这个地方,其根据post的data的类型来配置header的 content-type 首先配置默认的然后根据请求的时候所传data数据类型,重置content-type特别注意的是data为Form Data类型,由浏览器自己设定content-type,如果你自定义了,那么代码中会删除;同