Extracting map from session and using inside headers()

Hello Folks,

I have a case where a session variable (a Map) need to be used for http().headers(Map).

Currently I get below compile error when trying to do so:

20:30:45.333 [ERROR] i.g.c.ZincCompiler$ - …/user-files/simulations/myserver2/DownloadFromServer.scala:138: Cannot prove that Char <:< (String, String).

20:30:45.333 [ERROR] i.g.c.ZincCompiler$ - .headers("${headersMap}".toMap[String, String])

Here is a snippet of code:

scenario(“Setup Call”)

.exec(Some_Chain_Populating_Session_Map)

.exec(

http(“Setup Call”)

.post(“https://URL/”)

.header(“someSimpleHeader”, session => custom_header2(session))

.headers("${headersMap}".toMap[String, String]) <<<<<<------------------------- Error’d out line

)

})

If session Map is not possible, what are our options? Iterating over Map followed by adding “.header()” inside http() call?

Thanks,
Ashish

Hi ashisa:
Do you resolve this issue? I suffer from it too.

Hoping your help.

Hi Ashash:
Have you resolve it? I suffer from it too.

Thanks

my code as follow:

object AuthenticationExec {

  val login =
      feed(csv("execFeeders/login.csv").batch.random)
      .exec{ session=>
        val rq = new LoginRq()
        val body = rq.getBody(session("loginType").as[String], session("user").as[String], session("password").as[String])
        val url = rq.getUrl()
        val headers = rq.getHeader().asScala.toMap
        session.set("body",body).set("url",url).set("header",header)
      }
      .exec(
        http(Thread.currentThread().getStackTrace()(2).getMethodName())
        .post("${url}")
        .headers("${header}".toMap[String,String])
        .body(StringBody("${body}")).asJson
        .check(status.is(201))
        .check(jsonPath("$.token").saveAs("User-Token")))
}

The information in this e-mail and any attachments is confidential. It is intended solely for the addressee(s) named above. If you are not an intended recipient, please notify the sender and delete the message and any attachments from your system. Any use, copying or disclosure of the contents is unauthorised unless expressly permitted. Any views expressed in this message are those of the sender unless expressly stated to be those of OpenJaw. Virus checking of emails and attachments is the responsibility of the recipient and OpenJaw cannot accept responsibility for any loss or damage arising from the use of this email or attachments. OpenJaw Technologies Limited is a limited company registered in Ireland having registration number 353613 and registered office at Grattan Bridge House, 1 Ormond Quay Upper, Dublin 7.