[android测试]anyproxy校验请求数据

//用于校验TCL-750手机的运营上报数据

module.exports = {

summary : "catch device-promot response",

*beforeSendRequest(requestDetail){

if(requestDetail.url == "http://lecanbo.sifude.com/market/metrics/promot" &&

requestDetail.requestData.indexOf("device") != -1){

console.log("catch device-promot request");

//对requestbody进行urldecode获取请求body的string

var req_data = decodeURIComponent(requestDetail.requestData);

console.log("RequestData\n" + req_data);

//对requestbody根据&进行切片

var req_data_array = req_data.split("&");

console.log("biz_data\n" + req_data_array[0]);

var expect_biz_data = 'biz_data="期望的请求数据"';

if(expect_biz_data == req_data_array[0]){

console.log("[test result]success");

}else{

console.log("[test result]failed");

console.log(expect_biz_data);

console.log(req_data_array[0]);

}

}

}

};

你可能感兴趣的:([android测试]anyproxy校验请求数据)