Response.header.content-type can not be parsed

When user the rest connector it seems not possible to parse a header field with dashes?

For example the header field content-type is not picked up as a variable when using feel expression:

= {
content-type: response.headers.content-type
}

Hi @geert.janszen, welcome to the forum!

You can parse a header field with dashes. The notation changes a bit with dashes: instead of dot notation .field-name, you have to use bracket notation ['field-name']

Using your example, it should look like this:

= {  
 content_type: response.headers['content-type']
}

The example given is not a valid FEEL expression.
When parsing individual components of the header, upper and lower case must be taken into account.
Example header:

{
  “Connection": ‘keep-alive’,
  “cache-control": ‘no-cache, private’,
  “x-ratelimit-limit": ‘100’,
  “Content-Type": ”application/json”
}

Valid FEEL expression for parsing the “Content-Type” component:

{
content_type: response.headers.Content-Type
}

Sorry!
The hyphen is not a valid character in a FEEL variables name:
[Variables | Camunda 8 Docs]

See also:

Thanks for the hint from @nathan.loding!
The correct FEEL expression is now:

{
 content_type: get value(response.headers, “Content-Type”)
}

Again, as mentioned in my previous post, this is case-sensitive!
This FEEL expression has been successfully tested.