0

Im new to Gatling tool, trying to pass multiple header value from another file but im facing error while compiling.

Code:

val header0 = List(Map(
    "Ocp-Apim-Subscription-Key" -> TestParameters.Keyvalue,
    "UserId" -> TestParameters.UserID
  ))

Error:

ingInformation.scala:22:13: type mismatch;
 found   : scala.collection.immutable.Map[String,java.io.Serializable]
 required: Map[String,String]
                        .headers(header0)
                                 ^
Amerousful
  • 2,292
  • 1
  • 12
  • 26

1 Answers1

0

Why do you make header0 a List[Map[String, String]]?

It should be a Map[String, String]:

val header0 = Map(
  "Ocp-Apim-Subscription-Key" -> TestParameters.Keyvalue,
  "UserId" -> TestParameters.UserID
)

Also, as explained in the documentation, header values must be Strings. So if TestParameters.Keyvalue or TestParameters.UserID are anything else, such as numbers, you must convert them, eg with toString.

Stéphane LANDELLE
  • 6,076
  • 2
  • 10
  • 12