public string setRequestBody(string old_requestBody, UserTabpage oPage) { string requestBody; string[] requestBodyPar = null; List<Para> paraValue_list = oPage.getPara_list(); requestBodyPar = old_requestBody.Split(new char[1] { '&' }); foreach (Para para in paraValue_list) { if (para.getParaTypeComboBox().Text == "修改") { foreach (string ii in requestBodyPar) { if ((ii.ToString().Substring(0, para.getParaName().Length)) == para.getParaName()) { old_requestBody = old_requestBody.Replace(ii.ToString().Substring(ii.ToString().IndexOf("=") + 1), para.getParaValue()); } } } } requestBody = old_requestBody; AutoTamperReqBeforeHandler.rbody = old_requestBody; return requestBody; }
public string setRequestUrl(String ori_url, UserTabpage oPage) { string new_url; string[] requestPar = null; List<Para> paraValue_list = oPage.getPara_list(); requestPar = ori_url.Split(new char[2] { '?', '&' }); foreach (Para para in paraValue_list) { if (para.getParaTypeComboBox().Text == "修改") { foreach (string ii in requestPar) { if ((ii.ToString().Substring(0, para.getParaName().Length)) == para.getParaName()) { if(para.getParaName() == "sign") { string sign = this.Sign(para.getParaValue(), paraValue_list, oPage); ori_url = ori_url.Replace(ii.ToString().Substring(ii.ToString().IndexOf("=") + 1), sign); } else { ori_url = ori_url.Replace(ii.ToString().Substring(ii.ToString().IndexOf("=") + 1), para.getParaValue()); } } } } } new_url = ori_url; return new_url; }
/*更新返回值和json预览*/ public void updateResponseBody(UserTabpage oPage) { if (this.oSession.HTTPMethodIs("POST") && oPage.getRequestType_cb().Text == "POST" && this.oSession.uriContains(oPage.getUrlTextBox().Text) && this.oSession.GetRequestBodyAsString().Contains(oPage.getRequestbody_tb().Text)) { //oPage.updatepPreview_response1(); oSession.utilSetResponseBody(setResponseBody(oPage.getResponseTextBoxValue().Text, oPage.getPara_list(), oSession, oPage)); } else if (this.oSession.HTTPMethodIs("GET") && oPage.getRequestType_cb().Text == "GET" && this.oSession.uriContains(oPage.getUrlTextBox().Text)) { //oPage.updatepPreview_response1(); oSession.utilSetResponseBody(setResponseBody(oPage.getResponseTextBoxValue().Text, oPage.getPara_list(), oSession, oPage)); } }