1

I am having an issue with my script. The whole picture is that I get a param from response body, replace all "%2" character by "%252". After that I will put it to another request body. The replace character under is what I got from gg searching, it works fine. But when I apply that method, I get error even though I put a string in it. This is the character replacing method: ''' char * ReplaceString(const char *input_string,const char *substring_to_be_replaced,const char *substitution_string){

 char *strstr(const char *s1, const char *s2); 

char newstring[200]=""; 

const char *str; 

char *ptr; 

str = input_string;

 while((ptr = strstr(input_string, substring_to_be_replaced))!=NULL)
 {
     input_string = &ptr[strlen(substring_to_be_replaced)];
     ptr[0] = '\0';
     strcat(newstring, str);
     strcat(newstring, substitution_string);
     str = input_string;
 }

strcat(newstring, input_string);

return newstring;

} ''' And this is how I apply that:

'''

char corr_assertionToken[200]; sprintf(corr_assertionToken_1, "%s", lr_eval_string("{corr_assertertoken}"));

lr_save_string(ReplaceString(lr_eval_string("corr_assertionToken_1"), "%2", "%252"),"modified_corr_assertertoken");

'''

Thank you for your help, I really appriciate that.

Studier
  • 11
  • 1

0 Answers0