Skip to content

[workers] fix incorrect getCookie function in extract-cookie-value.md #2074

Closed
talismanium wants to merge 2 commits into
cloudflare:productionfrom
talismanium:patch-getcookie-function
Closed

[workers] fix incorrect getCookie function in extract-cookie-value.md #2074
talismanium wants to merge 2 commits into
cloudflare:productionfrom
talismanium:patch-getcookie-function

Conversation

@talismanium

Copy link
Copy Markdown

fix for correct cookie find. for example, if cookie values are aaaa=triple; aa=double;
call getCookie(request, 'aa') will return first occurance of "aa=", which leads to wrong value of "triple"

I fix searching phrase by leading space, and to all cookie string add leading space

fix for correct cookie find. for example, if cookie values are aaaa=triple; aa=double;
call getCookie(request, 'aa')   will return first occurance of "aa=", which leads to wrong value of "triple"

I fix searching phrase by leading space, and to all cookie string add leading space
@talismanium
talismanium requested a review from a team August 15, 2021 13:14
@talismanium
talismanium requested a review from a team as a code owner August 15, 2021 13:14
@kristianfreeman kristianfreeman added the product:workers Related to Workers product label Aug 16, 2021
@lukeed

lukeed commented Aug 18, 2021

Copy link
Copy Markdown
Contributor

Thanks for this! It spawned some discussion.

While technically this is more correct, it's also a little bit weird & still brittle for a production setting. We decided to update this example to use a third-party package so that it's robust and ready-to-go (#2101). Updating this example to be production-ready would just mean copy-pasting library code as an example, which isn't very ideal.

Thanks again~!

@lukeed lukeed closed this Aug 18, 2021
lukeed added a commit that referenced this pull request Aug 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

product:workers Related to Workers product

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants