Anyone object to turning the params member in HttpRequestWithParamsBuilder into a val?
This would allow me to do some trickery in my IntegrationUtils.
Basically, I accept a list of HttpRequestWithParamsBuilder. And I want to rename each of those with their (index + 1) number as a prefix.
I had tried to copy doing something like:
type Step = HttpRequestWithParamsBuilder
def renameStep(astep: (Step, Int)) = {
val (s, num) = (astep._1, astep._2+1)
val newName = numberName(num, s.commonAttributes.requestName)
val newAttrs = s.commonAttributes.copy(requestName = newName)
new Step(newAttrs, s.httpAttributes, newAttrs.queryParams)
}
But that’s not really doing what I think it should be doing (besides which, tests begin to fail).
I think it’d be more appropriate to do something like:
type Step = HttpRequestWithParamsBuilder
def numberName(num: Int, name: Expression[String]): Expression[String] = (s: Session) => name(s) match {
case Success(n) => “% 3d. %s”.format(num, n)
case Failure(f) => “% 3d. %s”.format(num, f)
}def renameStep(astep: (Step, Int)) = {
val (s, num) = (astep._1, astep._2+1)
val newName = numberName(num, s.commonAttributes.requestName)
val newAttrs = s.commonAttributes.copy(requestName = newName)
new Step(newAttrs, s.httpAttributes, s.params)
}
Thoughts? A better way of doing things? Want a pull request? Add the 4 chars yourself ?
Thanks,
–Spencer