首页 > 编程知识 正文

java有参有返回值方法调用,jmeter获取返回值里的数据

时间:2023-05-05 20:00:23 阅读:108077 作者:4749

getAccomodationCost是一个函数,必须返回带有返回值的promise。 当前抛出错误解决方案未定义。

然后,在promise内部的行解析(JSON.parse (JSON.stringify (result ) ) ) ) )中抛出此错误消息)。 将关键字resolve替换为return时,main函数的Promise.all

有人从以下函数返回带有返回值JSON.parse(JSON.stringify ) result )的promise。

vargetaccomodationcost=function {

varaccomodationcostpromise=new promise (function ) (resolve,reject ) ) ) ) ) )。

{

gethospitalstayduration(req,res,function ) duration )。

解析(duration )

() )

() )

. then (函数(duration ) {

hotelModel.aggregate([

//Some logic here

],function(err,result ) {

resolve(JSON.parse ) JSON.stringify (result ) )

() )

() )

返回加速成本属性;

}

//mainfunctionwheretheabovesnippetiscalled

constpromise1=somefunction(req,res );

constaccomodationcostpromise=getaccomodationcost (req,res ) ) ) ) ) ) ) ) ) ) ) ) ) 65 )

promise.all([promise1,accomodationCostPromise]

. then () (hospitalinfo,accomodationCost] ) ) )。

//returnsomejsonresponsefromhere

}.catch(function(err ) )。

returnRES.JSON((message ) :err.message );

);

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。