Skip to content

Adding warning about re-accessing request.formData() in all relevant places #22018

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 28, 2025

Conversation

Oxyjun
Copy link
Contributor

@Oxyjun Oxyjun commented Apr 28, 2025

Summary

The body of a Request can only be accessed once. This is explained in the warning note here:

image

Previously, this warning note was only present in a single page in R2. Now, this PR adds the warning note in all places where we show a code snippet which uses request.formData(), so that a user is aware of it (in case they use the code snippet as a springboard to create new code).

Screenshots (optional)

Documentation checklist

  • The documentation style guide has been adhered to.
  • 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.

places where the code uses request.formData().
Copy link
Contributor

hyperlint-ai bot commented Apr 28, 2025

Howdy and thanks for contributing to our repo. The Cloudflare team reviews new, external PRs within two (2) weeks. If it's been two weeks or longer without any movement, please tag the PR Assignees in a comment.

We review internal PRs within 1 week. If it's something urgent or has been sitting without a comment, start a thread in the Developer Docs space internally.


PR Change Summary

Enhanced documentation by adding a warning about the single access limitation of request.formData() across multiple relevant pages.

  • Added a cautionary note regarding the single access limitation of request.formData() in multiple documentation pages.
  • Introduced a new partial for the warning note to maintain consistency across the documentation.
  • Updated various tutorials and guides to include the new warning for better user awareness.

Modified Files

  • src/content/docs/images/tutorials/optimize-user-uploaded-image.mdx
  • src/content/docs/pages/functions/plugins/hcaptcha.mdx
  • src/content/docs/pages/functions/plugins/index.mdx
  • src/content/docs/pages/functions/plugins/turnstile.mdx
  • src/content/docs/pages/how-to/refactor-a-worker-to-pages-functions.mdx
  • src/content/docs/pages/tutorials/forms/index.mdx
  • src/content/docs/r2/api/workers/workers-api-usage.mdx
  • src/content/docs/r2/tutorials/summarize-pdf.mdx
  • src/content/docs/turnstile/tutorials/implicit-vs-explicit-rendering.mdx
  • src/content/docs/workers/examples/read-post.mdx
  • src/content/docs/workers/examples/turnstile-html-rewriter.mdx
  • src/content/docs/workers/tutorials/handle-form-submissions-with-airtable/index.mdx

Added Files

  • src/content/partials/workers/request-dot-clone-warning.mdx

How can I customize these reviews?

Check out the Hyperlint AI Reviewer docs for more information on how to customize the review.

If you just want to ignore it on this PR, you can add the hyperlint-ignore label to the PR. Future changes won't trigger a Hyperlint review.

Note specifically for link checks, we only check the first 30 links in a file and we cache the results for several hours (for instance, if you just added a page, you might experience this). Our recommendation is to add hyperlint-ignore to the PR to ignore the link check for this PR.

@github-actions github-actions bot added size/s product:images Related to Image Resizing product product:pages product:r2 R2 object storage: https://developers.cloudflare.com/r2 product:turnstile product:workers Related to Workers product labels Apr 28, 2025
Copy link
Contributor

github-actions bot commented Apr 28, 2025

Preview URL: https://d3f98258.preview.developers.cloudflare.com
Preview Branch URL: https://jun-workers-request-clone-partial.preview.developers.cloudflare.com

Files with changes (up to 15)

Original Link Updated Link
https://developers.cloudflare.com/r2/api/workers/workers-api-usage/ https://jun-workers-request-clone-partial.preview.developers.cloudflare.com/r2/api/workers/workers-api-usage/
https://developers.cloudflare.com/workers/examples/read-post/ https://jun-workers-request-clone-partial.preview.developers.cloudflare.com/workers/examples/read-post/
https://developers.cloudflare.com/images/tutorials/optimize-user-uploaded-image/ https://jun-workers-request-clone-partial.preview.developers.cloudflare.com/images/tutorials/optimize-user-uploaded-image/
https://developers.cloudflare.com/pages/functions/plugins/hcaptcha/ https://jun-workers-request-clone-partial.preview.developers.cloudflare.com/pages/functions/plugins/hcaptcha/
https://developers.cloudflare.com/pages/functions/plugins/ https://jun-workers-request-clone-partial.preview.developers.cloudflare.com/pages/functions/plugins/
https://developers.cloudflare.com/pages/functions/plugins/turnstile/ https://jun-workers-request-clone-partial.preview.developers.cloudflare.com/pages/functions/plugins/turnstile/
https://developers.cloudflare.com/pages/how-to/refactor-a-worker-to-pages-functions/ https://jun-workers-request-clone-partial.preview.developers.cloudflare.com/pages/how-to/refactor-a-worker-to-pages-functions/
https://developers.cloudflare.com/pages/tutorials/forms/ https://jun-workers-request-clone-partial.preview.developers.cloudflare.com/pages/tutorials/forms/
https://developers.cloudflare.com/turnstile/tutorials/implicit-vs-explicit-rendering/ https://jun-workers-request-clone-partial.preview.developers.cloudflare.com/turnstile/tutorials/implicit-vs-explicit-rendering/
https://developers.cloudflare.com/workers/examples/turnstile-html-rewriter/ https://jun-workers-request-clone-partial.preview.developers.cloudflare.com/workers/examples/turnstile-html-rewriter/
https://developers.cloudflare.com/r2/tutorials/summarize-pdf/ https://jun-workers-request-clone-partial.preview.developers.cloudflare.com/r2/tutorials/summarize-pdf/
https://developers.cloudflare.com/workers/tutorials/handle-form-submissions-with-airtable/ https://jun-workers-request-clone-partial.preview.developers.cloudflare.com/workers/tutorials/handle-form-submissions-with-airtable/

@Oxyjun Oxyjun enabled auto-merge (squash) April 28, 2025 15:55
@Oxyjun Oxyjun merged commit 6a2e25a into production Apr 28, 2025
13 checks passed
@Oxyjun Oxyjun deleted the jun/workers/request.clone-partial branch April 28, 2025 16:08
@GregBrimble
Copy link
Contributor

Correction: #22025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product:images Related to Image Resizing product product:pages product:r2 R2 object storage: https://developers.cloudflare.com/r2 product:turnstile product:workers Related to Workers product size/s
Projects
None yet
Development

Successfully merging this pull request may close these issues.