需要在header中添加Content-Type字段,Tornado后台获取用get_argument()方法。
this.$axios({
headers: {
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8',
"Authorization": 'Bearer ' + this.authorization,
},
method:'get',
url:this.ip + '/algorithms/'+this.currentId+"/version/"+verId ,
}).then((res) =>{
console.log(res)
let data = res.data.data
// self.historyData = data
self.historyData.create_time = data.create_time
self.historyData.algo_content= data.algo_content
self.isHistory = true
this.currentVersionId = verId
self.addNumberLine()
}).catch(function(err){
console.log(err)
})
本文介绍如何在前端使用Axios向Tornado后端发送请求,并正确设置Content-Type为application/x-www-form-urlencoded。通过get_argument()方法在Tornado中获取前端传来的参数。
2578

被折叠的 条评论
为什么被折叠?



