scala - Replace characters in foreach variable -


here code:

    def readentitymultipletimes(entityname: string, pathprefix: string = "") = {       val plural = entityname + "s"       exec(http(s"geting $plural")         .get(pathprefix + plural)         .check(status 200)         .check(jsonpath("$[*].id").findall.saveas("entityids"))       ).exec(s => {           if (loglevel >= 2) println("\nids:\n" + s("entityids"))           s       })       .pause(interval millis)       .foreach("${entityids}", "entityid") {         repeat(readentitynumber) {           exec(http(s"getting 1 $entityname")             .get(pathprefix + plural + "/${entityid}")              .check(status 200)           )         }       }     } 

the issue entityid may contain space , fails http request. need spaces replaced %20.

i tried gatling el ${entityid.replaceall(\" \", \"%20\")}" or ${java.net.urlencoder.encode(entityid)}

i guess suggested way entityid session , stuff in scala, variable dynamically created each loop iteration, not sure put "session lambda" (session => ...)

gatling el syntax limited , can't place scala code in there.

you indeed have pass function.

.get(session => pathprefix + plural + urlencoder.encode(session("entityid").as[string]))) 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -