setCookie only works on repeat call?

When I set a cookie using below script:
setCookie name=value

The result is not what I expect. The result should display the same image output in first view and the repeat view - but it doesn’t. The expected image always shows up in the repeat view, but never in the first view.


This seems basic and it would surprise me if this is a bug, but I cannot figure out what I am doing wrong. Isn’t it supposed to set the cookie for the first request?

Anyone got any ideas?

For those following along, we had an email thread and the script appears to be doing what it should and the cookie is being sent correctly. Looks like the issue is elsewhere in the application logic for handling the cookie.