I am unable to find context.getVariable("request.header.check") is exist or not.
If we are sending empty value for check in header.
context.getVariable('request.header.check.values.count') i am always getting 0
Solved! Go to Solution.
Hello @Guru Venkatesh
I am a little confused as to what you are trying to do. Are you trying to check if any headers are received in the request or if a specific header called 'check' is received?
I am guessing that you meant the latter.
If you are sending a HTTP header called 'check' in the request with no value in it, then request.header.check.values.count will show zero because as far as Apigee is concerned, there is no value in the header that is being sent.
Instead, if you send the below request :
curl -X GET -H "Content-Type: application/xml" -H "check: 1" -H "check: 11" "http://test.apigeeserver.com:80/v1/test"
then the value of request.header.check.values.count will be '2' because two headers called 'check' have been received in the request.
You can then use the variable request.header.check.values to get an array of all the values of the check header received in the request.
Does this clear your doubts?