Skip to main content

HTTP Session Cookies

Source file: examples/http_cookie_session.hen

What It Demonstrates

  • session = ... on ordinary HTTP requests
  • cookie jar reuse across requests
  • implicit request ordering through shared session state

Key Pattern

session = web
GET https://httpbin.org/cookies/set/session/hen-demo

---

session = web
GET https://httpbin.org/cookies

^ & body.cookies.session == "hen-demo"

Run It

hen verify ./examples/http_cookie_session.hen
hen run ./examples/http_cookie_session.hen all --non-interactive

What To Notice

  • The first request seeds the cookie jar for the named session.
  • The second request reuses that session without manually copying headers.
  • Session reuse works for ordinary HTTP requests, not just SSE, WebSocket, and MCP sessions.

Related reference: Protocols