question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrong typing for expires in set_cookie

See original GitHub issue

I think the type for https://github.com/encode/starlette/blob/55b0cbd045269a28a3f1b18f32ae3cb47226ab65/starlette/responses.py#L108

This should be a date according to https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie

So I think a better type is Optional[str] , or Optional[str | datetime] and provide the right formatting.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:14 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
Kludexcommented, Sep 30, 2022

I have the feeling we had this discussion before… Need to find where. 🤔

EDIT: Maybe not? EDIT2: It was not discussed before.

0reactions
Kludexcommented, Oct 24, 2022

Why is it unlikely?

Read more comments on GitHub >

github_iconTop Results From Across the Web

SetCookie::expire does not work: missing Domain part #23
I have tested it with Firefox 49.0.1 and Chrome 53.0.2785.143 and both behave in the same (standard?) way: the minimum requirement for expiring...
Read more >
Express doesn't set a cookie - node.js - Stack Overflow
I had the same issue. The server response comes with cookie set: Set-Cookie:my_cookie=HelloWorld; Path=/; Expires=Wed, 15 Mar 2017 15:59:59 GMT.
Read more >
setcookie - Manual - PHP
For instance, time()+60*60*24*30 will set the cookie to expire in 30 days. Another option is to use the mktime() function. If set to...
Read more >
Set-Cookie - HTTP - MDN Web Docs
Permanent cookies are removed at a specific date ( Expires ) or after a specific length of time ( Max-Age ) and not...
Read more >
setcookie
This is internally achieved by setting value to 'deleted' and expiration time to one year in past. Because setting a cookie with a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found