#2017·sanic

delete cookie doesn't support specifying the path.

Author: ruckcCreated Feb 1, 2021Updated May 23, 2026
Labelsneeds investigation

Describe the bug Unable to delete a cookie set created with a non-default (/) path.

Code snippet With this cookie response.cookie['token'] = "abcd" response.cookie['token']["path"] = "/api"

the subsequent delete of the cookie doesn't work del response.cookie['token']

as it sends Set-Cookie: token=""; Path=/; Max-Age=0 where the original cookie was scoped to /api.

Expected behavior A method to delete the cookie and specify the path for the set-cookie header.

Environment (please complete the following information):

  • OS: Linux, Python 3.9
  • Version: 20.12.1