BunRequest object includes a cookies property that provides a CookieMap for easily accessing and manipulating cookies. When using routes, Bun.serve() automatically tracks request.cookies.set and applies them to the response.
Reading cookies
Read cookies from incoming requests using thecookies property on the BunRequest object:
Setting cookies
To set cookies, use theset method on the CookieMap from the BunRequest object.
Bun.serve() automatically tracks modified cookies from the request and applies them to the response.
Deleting cookies
To delete a cookie, use thedelete method on the request.cookies (CookieMap) object:
Set-Cookie header on the response with the maxAge set to 0 and an empty value.