I cannot get the full value of the header with Apigee using JavaScript. Only a partial header value is returned.
Instead of getting:
Location: http://partners.api.skyscanner.net/apiservices/pricing/v1.0/c7b98b9cc3f14fb39b13645b0361bba7_ecilpojl_84BDF90D45EB6E187527B8F6DDD1B814/booking/16130-1409241445-CM,LA-4-10815-1409250800;10815-1410011920-LA,CM-4-16130-1410022313
I'm getting the value with everything after comma (,) missing:
Location: http://partners.api.skyscanner.net/apiservices/pricing/v1.0/c7b98b9cc3f14fb39b13645b0361bba7_ecilpojl_84BDF90D45EB6E187527B8F6DDD1B814/booking/16130-1409241445-CM
I've tried both:
var a = context.targetResponse.headers.Location;
var b = context.getVariable('response.header.Location');
Is there a workaround to this issue?
I think this is because comma in header may be understood by Apigee gateway as a multivalued header. To get a comma separated multivalued header try:
request.header.Location.values
Alternately, you can make sure that the target server sends URL encoded value in the Location header. In that way comma becomes %2C. No problems in parsing that as a single value.