使用 axios 传递 application/x-www-form-urlencoded类型的 post 请求

正确姿势,用&把参数连接起来就行了,不过这个要不要 url 编码下呢?没有仔细研究过

    res = await http.post('https://aa.xxx.xyz.cn/index.php/?isAjax=true',"id=78&store=0&form_key=xniCOeOxjHEOaDYe&node=78", { headers: {
                'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
                } })

错误姿势

       res = await http.post('https://aa.xxx.xyz.cn/index.php/?isAjax=true',{
                id: category.id,
                store: 0,
                form_key: FORM_KEY,
                node: category.id,
            }, { headers: {
                'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
                } })

版权声明:本文为a735311619原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。