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 ...
随机推荐
- ubuntu14.04安装好Hadoo之后接着安装hbase和介绍常用命令
1.解压 tar -zxvf hbase-1.0.0-bin.tar.gzsudo mv hbase-1.0.0 /opt/hbasecd /optsudo chmod -R 775 hbase 2. ...
- opencv:自定义滤波
卷积核的定义 均值卷积核 // 自定义滤波 - 均值卷积 int k = 15; Mat mkernel = Mat::ones(k, k, CV_32F) / (float)(k * k); Mat ...
- Jmeter BeanShell笔记
前言:beanshell是支持java语法的,因此当一些复杂的数据结构jmeter处理不了的时候,我们可以借助于java来实现 1,使用beanshell处理JDBC请求返回的值 数据库结构 当JDB ...
- PostgreSQL日期加减
在PostgreSQL中可以直接对时间进行加减运算:. SELECT now()::timestamp + '1 year'; --当前时间加1年 SELECT now()::timestamp + ...
- 将信息存储在claim中,通过扩展AbpSession取出
一.将信息存储到claim中 claims.AddRange(new[] { //新增身份,添加租户id new Claim("RoleName","管理员111&quo ...
- Android 调起系统相机拍照
概述 最近在看 nanChen 写的图片选择器 ImagePicker,感觉写得很不错,也打算把从中学到的东西写下来.很多时候,遇到一个好的框架能够降低开发成本这是好事.但是也要去了解其内部具体实现逻 ...
- 记springboot 实体类String转Date类型的坑
前端传入一个String的时间字符串如:2019-07-18 23:59:59 后端实体类要在头顶加注解: @DateTimeFormat(pattern = "yyyy-MM-dd HH: ...
- 一个包含arctan与arctanh的积分
\[\Large\int_0^1\frac{\arctan x \,\operatorname{arctanh} x\, \ln x}{x}\mathrm{d}x=\frac{\pi^2}{16}\m ...
- same-security-traffic
关于Inter-interface和intra-interface: 要允许具有相同安全级别的接口之间的通信,或允许流量进入和退出同一接口,请在全局配置模式下使用same-security-traff ...
- VS中编码格式的问题(待总结)
今天又遇到这样的事情了,VS中代码明明是正确的,却报某个变量未定义.百思不得解,前面增加了一个换行之后,竟然又神奇般的复原了. 最后确认是编码格式的问题,后来把有问题的那部分代码粘贴到微软的" ...