axios发送post请求[body-parser]--['Content-type': 'application/x-www-form-urlencoded']
const express = require('express')
const axios = require('axios')
const bodyParser = require('body-parser')
const app = express()
const apiRoutes = express.Router()
app.use('api/', apiRoutes)
app.use(bodyParser.urlencoded({extended: true})) // 获取歌曲播放地址
app.post('/api/getPurlUrl', bodyParser.json(), function (req, res) {
const url = 'https://u.y.qq.com/cgi-bin/musicu.fcg'
axios.post(url, req.body, {
headers: {
referer: 'http://ustbhuangyi.com/music/',
origin: 'http://ustbhuangyi.com',
'Content-type': 'application/x-www-form-urlencoded'
}
}).then((response) => {
res.json(response.data)
}).catch((e) => {
console.log(e)
})
})
axios发送post请求[body-parser]--['Content-type': 'application/x-www-form-urlencoded']的更多相关文章
- Jmeter发送post请求报错Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported
常识普及: Content-type,在Request Headers里面,告诉服务器,我们发送的请求信息格式,在JMeter中,信息头存储在信息头管理器中,所以在做接口测试的时候,我们维护Conte ...
- 使用axios发送post请求,将JSON数据改为为form类型
我的github(PS:希望star):https://github.com/thWinterSun/v-admin 通常前端通过POST请求向服务器端提交数据格式有4中,分别是"appli ...
- axios发送post请求后台接受不到问题
axios发送post请求后台接受不到问题 1.首先这是前端的问题 2.解决方案不唯一,但这招肯定行 <!DOCTYPE html> <html> <head> & ...
- ajax使用向Spring MVC发送JSON数据出现 org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported错误
ajax使用向Spring MVC发送JSON数据时,后端Controller在接受JSON数据时报org.springframework.web.HttpMediaTypeNotSupportedE ...
- Axios发送AJAX请求
目录 Axios 特征 axios提供主要三种发起请求的方式 方式一:直接axios实例直接call方式 方式二:通过axios实例提供的不同http请求方式的方法 方式三:其实是从第二种方式中单独提 ...
- axios发送post请求,如何提交表单数据?
axios发送post请求,提交表单数据的方式 默认情况下,axios将JavaScript对象序列化为JSON.要以application / x-www-form-urlencoded格式发送数据 ...
- 接入WxPusher微信推送服务出现错误:Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported
背景 使用WxPusher微信推送服务 ,可以及时的将服务的一些运行异常信息,发送到自己的微信上,方便了解服务的运行状态(PS:这个服务是免费的). 你可以在这里看到WxPusher微信推送服务的接入 ...
- jmeter报"msg":"Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported"的解决方法
1.报"msg":"Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supporte ...
- Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported
Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported告诉你,你的请求头是application/x- ...
- springboot 报错 Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported
开始 controller 方法写的是 @RequestMapping( value = "/add", method = RequestMethod.POST ) public ...
随机推荐
- hbase60010端口无法访问web页面
原因:HBASE1.0之后的版本web端访问的接口变更为16010
- MyBatis操作mysql数据库查询出来是时间戳的问题
在pojo类中用java.sql.Date接收就能正常显示
- thinkphp 连接webservice接口
嗯,我现在真的好像骂人啊,但是我又是个文明的人,所以我就写出来让自己冷静一下 ok,正事,thinkphp连别人写的webservice接口 刚开始他叫什么nc接口,就把我给骗了,这就是人家的名字,和 ...
- 深入理解Java虚拟机(1)
Java内存区域 对于Java程序员来说,在虚拟机的自动内存管理机制下,不再需要为每一个new操作去写配对的delete和free代码,不容易出现内存泄露和内存溢出问题,可以直接交给虚拟机进行管理. ...
- 本地缓存Caffeine
Caffeine 说起Guava Cache,很多人都不会陌生,它是Google Guava工具包中的一个非常方便易用的本地化缓存实现,基于LRU算法实现,支持多种缓存过期策略.由于Guava的大量使 ...
- rsync安装与配置使用 数据同步方案(centos6.5)
rsync + crond ==定时数据同步 sersync(inotify) + rsync ==实时数据同步,利用rsync实现 ##应用场景 ..1 主备服务器之间同步数据定时 = ...
- openjudge(POJ)-1664 放苹果
对于n个盘子,m个苹果,我们要么在每个盘子上都放苹果,要么至少有一个盘子不放. 一个盘子不放就是f(m,n-1),全部都放的时候苹果就变成了n-m个,但是盘子的数目是不变的,因为此时还没有产生方案数, ...
- 在Linux系统中使用ntfs、fat32格式的存储设备
在Linux系统中使用ntfs.fat32格式的存储设备 我们通常使用的移动硬盘或U盘一般都是ntfs或fat32的文件系统,作为一名运维工程师,经常会遇到把移动硬盘或者U盘上的内容拷贝的Linu ...
- cf--TV Subscriptions (Hard Version)
time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standa ...
- 使用Dotfunsctor
设置Disable Control Flow.Disable Renaming.Disable String Encryption 为no,no为开启该功能 设置加密后输出的路i经 选择需要加密的ex ...