0

I am fetching cookies with the following code:

Cookie[] cookies = httpRequest.getCookies();

Sometimes it fetches all the cookies, sometimes it doesn't.

screenshot 1

As shown in the image, in inspect element its showing 2 SESSION cookies.

But as shown in the second image it's only fetching one. Why is this happening?

screenshot 2

anothernode
  • 5,100
  • 13
  • 43
  • 62
Reva
  • 784
  • 6
  • 8
  • Both are same cookies. Check the value – Sandesh Gupta May 17 '18 at 12:21
  • actually one cookie is browser created ans the other is which my code created with integer.maxvalue age... some times its showing as 2 cookies but sometimes its fetching only one. – Reva May 17 '18 at 13:54
  • Check the `domain` and `path` values for the cookies. The fact that they appear the same doesn't mean the are the same or valid for the URL you are calling. – M. Deinum May 17 '18 at 14:04
  • i have not set both domain path, they are null. – Reva May 17 '18 at 15:43

0 Answers0