我无法在beego中使用自动参数处理,这是我的代码
const realNumberArray = [4, 5.6, -9.8, 3.14, 42, 6, 8.34];
const squareList = (arr) => {
"use strict";
const squaredIntegers = (arr) => {
let arrayChoosen = arr.filter(ele => ele > 0 && Number.isInteger(ele));
return arrayChoosen.map(x => x * x);
}
return squaredIntegers(arr);
};
// test your code
const squaredIntegers = squareList(realNumberArray);
console.log(squaredIntegers);
当我从python请求发送请求时
ns := beego.NewNamespace("/api",beego.NSAutoRouter(&controllers.DevicesController{}))
type DevicesController struct {
beego.Controller
}
func (c *DevicesController) FuncTest(id int, field string) {
c.Data["json"] = map[string]interface{}{"status": "ok", "message": "Automatic parameter Success"}
c.ServeJSON()
}
我遇到以下错误
requests.post("http://localhost:8080/api/devices/functest?id=5&field=test")