KB Article #178753

Unable to access headers with hyphens in the name

Problem

When Extract REST Request Variables creates a variable containing a hyphen like http.header.User-Agent, it's not accessible from a selector like ${http.header.User-Agent}

Resolution

Selectors are interpreted according to JUEL syntax, so the hyphen is interpreted as a minus sign and it ends up trying to do a subtraction, which results in an invalid value. You should use this alternate syntax to access the value instead: ${http.header["User-Agent"]}