I have a problem with TotalJs Framework and Unirest Module.
Error: **TypeError: Object function (count){var arr=[];var self=this;var length=self.length;for(var i=0;i=count)return arr}return arr} has no method 'toLowerCase' TypeError: Object function (count){var arr=[];var self=this;var length=self.length;for(var i=0;i=count)return arr}return arr} **has no method 'toLowerCase'****
function view_homepage() {
var self = this;
var unirest = require('unirest');
unirest.post('http://httpbin.org/post')
.headers({ 'Accept': 'application/json' })
.send({ "parameter": 23, "foo": "bar" })
.end(function (response) {
console.log(response.body);
});
self.view('homepage');
}
But i don't understand this error because with sails.js it works fine.
Thank you
You can use a built-in function:
function view_homepage() {
var self = this;
Utils.request('http://httpbin.org/post', ['post', 'json'], { parameter: 23, foo: 'bar' }, function(err, response, status, headers) {
console.log(err, response);
});
self.view('homepage');
}
Documentation:
http://docs.totaljs.com/v1.7.x/en.html#api~FrameworkUtils~Utils.request
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.