Skip to content
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

[Rules] Snippets example to follow redirects from origin #18522

Merged
merged 3 commits into from
Dec 3, 2024

Conversation

nikitacano
Copy link
Contributor

Summary

Add example to Snippets gallery that shows how to modify the fetch request to follow redirects from the origin, ensuring the client receives the final response.

@nikitacano nikitacano requested review from pedrosousa and a team as code owners December 3, 2024 11:29
@nikitacano nikitacano changed the title Snippets follow redirects [Rules] Snippets example to follow redirects from origin Dec 3, 2024
Copy link
Contributor

@hyperlint-ai hyperlint-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, 1 total issue(s) found.

This template is ready for use and should fit most redirect-following scenarios.

It ensures the Snippet transparently follows redirects issued by the origin server.
The `fetch()` API’s `redirect: "follow"` option ensures automatic handling of `3xx` redirects, returning the final response. If the origin response is not a redirect, the original content is returned.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The `fetch()` APIs `redirect: "follow"` option ensures automatic handling of `3xx` redirects, returning the final response. If the origin response is not a redirect, the original content is returned.
The `fetch()` API's `redirect: "follow"` option ensures automatic handling of `3xx` redirects, returning the final response. If the origin response is not a redirect, the original content is returned.

Issues:

  • Style Guide - (cloudflare.NonStandardQuotes-warning) Use standard single quotes or double quotes only. Do not use any of the following quote mark types: ‘ ’ “ ”. In the text, we found this character: ’

Fix Explanation:

The issue identified is the use of a non-standard curly apostrophe ’ in the word "API’s". This should be replaced with a standard single quote ' to comply with the style guide. The rest of the text is correct, including the use of back-tick marks and double quotes around "follow".

Copy link

cloudflare-workers-and-pages bot commented Dec 3, 2024

Deploying cloudflare-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 459ea4f
Status: ✅  Deploy successful!
Preview URL: https://7963c243.cloudflare-docs-7ou.pages.dev
Branch Preview URL: https://snippets-follow-redirects.cloudflare-docs-7ou.pages.dev

View logs

@pedrosousa pedrosousa merged commit a65a29a into production Dec 3, 2024
12 checks passed
@pedrosousa pedrosousa deleted the snippets-follow-redirects branch December 3, 2024 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
product:rules Related to rules size/s
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants