Reputation: 33
so I wrote some test features and I want to add User-Agent header globally. I updated my karate-config.js file for that. And I add the code below.
karate.configure('headers', { User-Agent: 'Karete-Apache-HttpClient/4.5.13 (Java/11.0.15)' });
But this doesn't work for me cause Polyglot Exception. The error message is:
org.graalvm.polyglot.PolyglotException: SyntaxError: Unnamed:4:35 Expected : but found -
I guess this is a bug but not sure about that. I tried this feature with "Accept" header and that's work correctly but I can't add any headers with "-" character in karate-config.js file, cause this error. Thanks for answers.
Upvotes: 2
Views: 566
Reputation: 58058
This is just a JS / JSON thing. Special characters mean that keys also have to be enclosed in quotes. Try this:
karate.configure('headers', { 'User-Agent': 'Karate-Apache-HttpClient/4.5.13 (Java/11.0.15)' });
Upvotes: 2