This repository has been archived by the owner on Jan 11, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Man, cookies suck. Took me a long time to figure the following out:
Set-Cookie
header contain the key and value (foo=bar
), but also a number of attributes (which could have values, likeMax-Age=3600
, but needn't, likeHttpOnly
). These are separated by a semi-colon. The order of attributes doesn't matter, but the key/value must go firstSet-Cookie
headers (i.e. you can't set multiple cookies in a single header)response.setHeader('Set-Cookie', '...')
multiple times. Instead you must pass an array as the second argument (response.setHeader('Set-Cookie', ['a=1', 'b=2'])
). No error or warning will be given if you get this wrongres.getHeader('Set-Content')
could therefore return either a string or an array of stringsSet-Cookie
header except that it means something completely different (the semi-colon now separates cookies, not attributes)cookie
library,cookie.parse
works with the cookies the client sends to the server but not the other way aroundAnyway, Sapper was behaving incorrectly because I didn't understand all that until now. This PR fixes it.