I'm beginning with node.js and i'm trying to do a simple request. I'm using "request": "^2.87.0"
       output = "Hello ";
        const h = {'content-type': 'application/json'};
        const u = weburl;
        const b = JSON.stringify({
            "username" : user,
            "password" : psw
        });
        request.post({
            headers : h,
            url : u,
            body : b
        },function(error,response,body){
            if (error)
                output+= error;
            else {
                var jsonbody = JSON.stringify(body); //jsonbody = "\"token\""
                jsonbody = jsonbody.substr(3,jsonbody.length-4); // jsonbody = token
                console.log(jsonbody);
                output += jsonbody;
            }
        });
        send_message(output);
The token is shown in the console, but the output is "Hello" instead of "Hello token"
 
    