Add test for setCookie regression

See #1031, #1121, #1092
Merge pull request #1128 from nylen/setCookie-regression

Add test for setCookie regression