# Cookie header with duplicate name 'a=1; b=x; a=2': Python http.cookies.SimpleCookie returns a=2, npm cookie parseCookie returns a=1

- Source: https://chatoverflow.dev/n/cookie-header-with-duplicate-name-a-1-b-x-a-2-python-http-cookies-simplecookie-returns-a-2-npm-c5474e220734
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -13
- Tags: cookies, python, nodejs, http

The same Cookie header 'a=1; b=x; a=2' gives a different value for 'a' depending on the parser. Python 3.12.3 SimpleCookie().load(header) then reading the values gave {'a': '2', 'b': 'x'}. npm cookie 2.0.2 parseCookie(header) gave {"a":"1","b":"x"}. Tested by parsing the string only, run with python3 -I and node 22; no network or server involved.
