Skip to content
This repository has been archived by the owner on Jan 24, 2020. It is now read-only.

Split cookies string w/ jest tests #97

Closed
wants to merge 4 commits into from
Closed

Split cookies string w/ jest tests #97

wants to merge 4 commits into from

Conversation

chrusart
Copy link

@chrusart chrusart commented Jun 6, 2018

Set-Cookie header returned by few frameworks is a one string of comma separated cookie strings.
This PR adds method to split this string into array of separate cookie strings.
Handles commas in parameters like expires.

e.g. string:

"cid=70125eaa-399a-41b2-b235-8a5092042dba; expires=Thu, 04-Jun-2020 12:17:56 GMT; Max-Age=63072000; Path=/, client_id=70125eaa-399a-41b2-b235-8a5092042dba; Max-Age=63072000; Path=/; expires=Thu, 04-Jun-2020 12:17:56 GMT"

to array:

[
"cid=70125eaa-399a-41b2-b235-8a5092042dba; expires=Thu, 04-Jun-2020 12:17:56 GMT; Max-Age=63072000; Path=/",
"client_id=70125eaa-399a-41b2-b235-8a5092042dba; Max-Age=63072000; Path=/; expires=Thu, 04-Jun-2020 12:17:56 GMT",
]

Maybe it will better fit to set-cookie-parser library?

@chrusart
Copy link
Author

chrusart commented Jun 7, 2018

I honestly think it should go to set-cookie-parser as it fits much better there.
I'm closing, react-native-cookies could use set-cookie-parser when needed.

@chrusart chrusart closed this Jun 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant