Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
backend ruleP1universalStack: node
correctnesshttpcookiesrobustness
Do not assume only one Set-Cookie header is returned
When reading a cookie from an upstream response, find the specific cookie by name rather than blindly taking the first of potentially many.
PR: vinify-backend · org-mining-deep-2026-06Created: Jun 17, 2026
Bad example
Old codetypescript
| 1 | const sessionId = res.headers['set-cookie'][0]; // may not be the session |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | const sessionId = parseCookie(res.headers['set-cookie'], 'sessionId'); |
Explanation (EN)
Objašnjenje (HR)