A Set-Cookie header for a session needs HttpOnly, Secure and a SameSite policy, and the cookie is the only place those live. This produces the whole header, attributes included, rather than just the value.
What you can control
- Complete
Set-Cookieheaders with the security attributes a session cookie should carry. - JWT-shaped tokens with a real base64url header and payload, so a decoder can read the claims.
- API keys use the
sk_liveandsk_testprefix convention that makes an environment mix-up obvious. - Token length is adjustable, for testing a column limit or a header size cap.
Testing ideas
- Cookie attributes. Generate
Set-Cookieheaders with security attributes to test parsing ofHttpOnly,SecureandSameSite. - JWT rejection. JWT-shaped tokens have random signatures, so verification must fail. Use them to confirm your API rejects forged tokens.
- Length limits. Long tokens test header and column size limits.
- Never real secrets. These are seeded and predictable. Use your framework's session store or a CSPRNG for real tokens.
What this is not
JWT tokens here have a syntactically valid structure but a random signature, so any library will reject them at verification. That makes them useful for testing the failure path and useless for the success path.