Announcements
This site is in read only until July 22 as we migrate to a new platform; refer to this community post for more details.
Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

How to check header is exist or not ?

Not applicable

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 Solved
0 7 6,392
1 ACCEPTED 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?

View solution in original post

7 REPLIES 7