get_cookie()
get_cookie()
is a macro for getting the Cookie
from request headers.
#include "ecewo.h"
void get_cookie_handler(Req *req, Res *res){ char *theme = get_cookie("theme");
if (!theme) { send_text(404, "Cookies not found"); return; }
send_text(200, theme); free(theme);}
The variable of get_cookie()
has to be freed always.