As per the HTTP standard guidelines, Max-Age for a Set-Cookie can only be an integer.
Max-Age=
Optional
Number of seconds until the cookie expires. A zero or negative number will expire the cookie
immediately. Older browsers (ie6, ie7, and ie8) do not support max-age. For other browsers, if both > (Expires and Max-Age) are set, Max-Age will have precedence.
Current Cookie class provided by sanic has a fallback catch block that uses any value that you provide to max-age as a valid item and sets it.
If you pass a valid interger value to the max-age parameter, it needs to be set. Otherwise, it needs to be defaulted to -1 or 0 causing it to auto expire.
Most helpful comment
Related test:
https://github.com/huge-success/sanic/blob/cea1547e08230b6ad49eb7777fd8db5335382b7a/tests/test_cookies.py#L141-L156