Header variable truncated

Am facing an issue reading a header variable from JAVASCRIPT in APIGEE
when i look at the tracer i can see the full value of that header
But when i extract the value using context.getVariable() function am not getting the full string value
For example i have the header coming as : “Hello,APIGEE,WORLD”
when i extract it am getting only “Hello” but if i replace the comma with something else like | amd getting the word after it , so seems like the comma is causing the issue but am not able to understand what could be the issue , is it a filter inside the implementation of getVariable function?
how i can solve this cause i need my text to be in this format.

1 Like
var v = context.getVariable('message.header.HEADERNAME.values.string');

see doc here: https://cloud.google.com/apigee/docs/api-platform/reference/variables-reference#message

In HTTP headers, a comma denotes separate values. These are semantically equivalent:

My-Header: A
My-Header: 187183
My-Header: "fifteen"

My-Header: A, 187183, "fifteen"

When you read message.header.HEADERNAME , Apigee returns “the first” value of the HTTP header, when there are multiple values. If you want all of them, concatenated with the comma, you need to retrieve a different variable: message.header.HEADERNAME.values.string .

2 Likes