loadrunner post提交json格式


Action()
{


  //web_reg_save_param ("S_respond","LB=","RB=",LAST);

  //web_reg_save_param("saveTestCode","LB=saveTestCode\":\"","RB=\"",LAST);
  web_add_header("Content-Type","application/json;charset=UTF-8");

  lr_start_transaction("saveTestCode");

  web_custom_request("saveTestCode",
  "URL=http://127.0.0.1:88/saveTestCode",
  "Method=POST",
  "TargetFrame=",
  "Resource=0",

  "RecContentType=application/json",
  "Referer=",
  //"Snapshot=t3.inf",
  "Mode=HTTP",
  //"EncType=application/json;charset=UTF-8",
  "Body={\"userName\":\"{userName}\",\"content\":\"{content}\"}",
  LAST);


  lr_end_transaction("saveTestCode", LR_AUTO);

  //打印返回信息
  //lr_convert_string_encoding ( lr_eval_string ("{S_respond}"),LR_ENC_UTF8 ,NULL,"respond");

  //打印转码后的响应报文
  //lr_output_message ( "\nlistGames :%s",lr_eval_string ("{respond}"));

  return 0;
}

posted @ 2020-10-21 16:56  金虹巴巴  阅读(514)  评论(0编辑  收藏  举报