Skip to content

docs: fix undefined request variable in A/B testing middleware example#28453

Open
DearAsutosh wants to merge 1 commit intocloudflare:productionfrom
DearAsutosh:28447-fix-ab-testing-request-variable
Open

docs: fix undefined request variable in A/B testing middleware example#28453
DearAsutosh wants to merge 1 commit intocloudflare:productionfrom
DearAsutosh:28447-fix-ab-testing-request-variable

Conversation

@DearAsutosh
Copy link

Summary

Fixes an undefined variable in the "A/B testing with middleware" example.

The snippet previously referenced:

request.headers.get("cookie")

However, request is not defined in this context. Cloudflare Pages Functions middleware exposes the request via context.request.

This PR updates the example to:

context.request.headers.get("cookie")

so that the code aligns with the Pages Functions API and works as expected.

Fixes #28447

Documentation checklist

  • Is there a changelog entry (guidelines)? If you don't add one for something awesome and new (however small) — how will our customers find out? Changelogs are automatically posted to RSS feeds, the Discord, and X.
  • The change adheres to the documentation style guide.
  • If a larger change - such as adding a new page- an issue has been opened in relation to any incorrect or out of date information that this PR fixes.
  • Files which have changed name or location have been allocated redirects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Functions example for "A/B testing with middleware" appears untested and wrong

5 participants

Comments