Why am I unable to change Content-Type?

Hi,

I have a strange issue where I try to set content type header to “text/xml; charset=utf-8” yet the requests are sent with “application/xml”

I tried adding header to the actual API call which looks like:

val getConfig: ChainBuilder = {
  exec(http("Config")
    .post("url")
    .header("SOAPAction","value")
    .header("Content-Type", "text/xml; charset=utf-8")
    .body(ElFileBody("src/resources/xml/Config.xml")).asXml
    .check(status.in(200, 201,203,206,226,204,207,302)))
}

And also to my httpconf which looks like:

val soap_adapter_contentType: String = "text/xml; charset=utf-8"
val httpconf: HttpProtocolBuilder = http.baseUrl(Config.soap_adapter_url).header("Content-Type",soap_adapter_contentType)


Have you checked what asXml actually do?
https://gatling.io/docs/current/http/http_request/#headers

Cant believe I missed that, thank you so much!

As you are already providing the headers

  .header("SOAPAction","value")
  .header("Content-Type", "text/xml; charset=utf-8")

try with removing .asXml

body(ElFileBody("src/resources/xml/Config.xml"))