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

chore: make followRedirect option accept functions #2306

Merged
merged 7 commits into from
Nov 29, 2023

Conversation

VanTigranyan
Copy link
Contributor

@VanTigranyan VanTigranyan commented Oct 26, 2023

Checklist

  • I have read the documentation.
  • I have included a pull request description of my changes.
  • I have included some tests.
  • If it's a new feature, I have included documentation updates in both the README and the types.

@VanTigranyan
Copy link
Contributor Author

With these changes, it is possible to pass the followRedirect option as a function that gets a PlainResponse right before the redirect is done and returns true or false. By that, it is possible to decide whether to redirect dynamically. The option supports both plain boolean and function type, allowing users to decide for themselves which type they prefer.

source/core/options.ts Show resolved Hide resolved
.gitignore Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
@VanTigranyan
Copy link
Contributor Author

@sindresorhus Made the fixes you asked for. Thanks for the quick review.

@VanTigranyan
Copy link
Contributor Author

@sindresorhus BTW: I would be happy to contribute by adding a semantic release setup that would increase the version of the lib based on commit messages and would publish automatically.

@sindresorhus
Copy link
Owner

sindresorhus commented Oct 29, 2023

I would be happy to contribute by adding a semantic release setup that would increase the version of the lib based on commit messages and would publish automatically.

No thanks. I prefer the human touch to releasing and changelogs.

@sindresorhus sindresorhus merged commit 7c3f147 into sindresorhus:main Nov 29, 2023
2 checks passed
Vylpes pushed a commit to Vylpes/random-bunny that referenced this pull request Jan 16, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [got](https://github.com/sindresorhus/got) | resolutions | major | [`^13.0.0` -> `^14.0.0`](https://renovatebot.com/diffs/npm/got/13.0.0/14.0.0) |

---

### Release Notes

<details>
<summary>sindresorhus/got (got)</summary>

### [`v14.0.0`](https://github.com/sindresorhus/got/releases/tag/v14.0.0)

[Compare Source](sindresorhus/got@v13.0.0...v14.0.0)

##### Breaking

-   Require Node.js 20 ([#&#8203;2313](sindresorhus/got#2313))  [`a004263`](sindresorhus/got@a004263)
    -   Why not target the oldest active Node.js LTS, which is Node.js 18? I usually strictly follow this convention in my packages. However, this package is the exception because the HTTP part of Node.js is consistently buggy, and I don't have time to work around issues in older Node.js releases. I you need to still support Node.js 18, I suggest staying on Got v13, which is quite stable. Node.js 18 will be out of active LTS in 5 months.

##### Improvements

-   Make `followRedirect` option accept a function ([#&#8203;2306](sindresorhus/got#2306))  [`7c3f147`](sindresorhus/got@7c3f147)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4wLjAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4wLjAiLCJ0YXJnZXRCcmFuY2giOiJkZXZlbG9wIn0=-->

Reviewed-on: https://gitea.vylpes.xyz/RabbitLabs/random-bunny/pulls/134
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants