8000 Fix: allow invalid arguments to throw appropriate Error message by Zen-cronic · Pull Request #2367 · sindresorhus/got · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix: allow invalid arguments to throw appropriate Error message #2367

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 2 commits into

Conversation

Zen-cronic
Copy link
Contributor

Fixes: #2366

When invalid arguments are passed to the got function such as false, the new Options() returns undefined. But that option object is destructured without checking for it being undefined inside the got function.

Checklist

  • I have read the documentation.
  • I have included a pull request description of my changes.
  • I have included some tests.

@sindresorhus sindresorhus merged commit f44ef43 into sindresorhus:main Jul 24, 2024
1 check passed
@Zen-cronic Zen-cronic deleted the fix/check-url branch July 24, 2024 13:57
Vylpes pushed a commit to Vylpes/random-bunny that referenced this pull request Sep 2, 2024
This PR contains the following updates:

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

---

### Release Notes

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

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

[Compare Source](sindresorhus/got@v14.4.1...v14.4.2)

-   Fix handling of invalid arguments ([#&#8203;2367](sindresorhus/got#2367))  [`f44ef43`](sindresorhus/got@f44ef43)

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

[Compare Source](sindresorhus/got@v14.4.0...v14.4.1)

-   Fix missing dependency  [`dfc54d9`](sindresorhus/got@dfc54d9)

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

[Compare Source](sindresorhus/got@v14.3.0...v14.4.0)

-   Improve TypeScript types with generic extend ([#&#8203;2353](sindresorhus/got#2353))  [`15ca4a0`](sindresorhus/got@15ca4a0)

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

[Compare Source](sindresorhus/got@v14.2.1...v14.3.0)

-   Update dependencies  [`dbab6c3`](sindresorhus/got@dbab6c3)

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

[Compare Source](sindresorhus/got@v14.2.0...v14.2.1)

-   Fix error handling when UTF-8 decoding fails ([#&#8203;2336](sindresorhus/got#2336))  [`c81a611`](sindresorhus/got@c81a611)

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

[Compare Source](sindresorhus/got@v14.1.0...v14.2.0)

-   Add `cause` property with the original error to `RequestError` ([#&#8203;2327](sindresorhus/got#2327))  [`4cbd01d`](sindresorhus/got@4cbd01d)

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

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

-   Allow typing the body of a `RequestError` response ([#&#8203;2325](sindresorhus/got#2325))  [`5e4f6ff`](sindresorhus/got@5e4f6ff)

</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:eyJjcmVhdGVkSW5WZXIiOiIzNy40MzEuNCIsInVwZGF0ZWRJblZlciI6IjM3LjQzMS40IiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCIsImxhYmVscyI6WyJ0eXBlL2RlcGVuZGVuY2llcyJdfQ==-->

Reviewed-on: https://git.vylpes.xyz/RabbitLabs/random-bunny/pulls/217
Reviewed-by: Vylpes <ethan@vylpes.com>
Co-authored-by: Renovate Bot <renovate@vylpes.com>
Co-committed-by: Renovate Bot <renovate@vylpes.com>
Graysonbarton added a commit to Graybar-codespace/Satoshi that referenced this pull request May 1, 2025
![snyk-top-banner](https://redirect.github.com/andygongea/OWASP-Benchmark/assets/818805/c518c423-16fe-447e-b67f-ad5a49b5d123)


<h3>Snyk has created this PR to upgrade got from 13.0.0 to 14.4.6.</h3>

:information_source: Keep your dependencies up-to-date. This makes it
easier to fix existing vulnerabilities and to more quickly identify and
fix newly disclosed vulnerabilities when they affect your project.

<hr/>

⚠️ **Warning:** This PR contains major version upgrade(s), and may be a
breaking change.

- The recommended version is **12 versions** ahead of your current
version.

- The recommended version was released **2 months ago**.



<details>
<summary><b>Release notes</b></summary>
<br/>
  <details>
    <summary>Package name: <b>got</b></summary>
    <ul>
      <li>
<b>14.4.6</b> - <a
href="https://redirect.github.com/sindresorhus/got/releases/tag/v14.4.6">2025-02-10</a></br><ul>
<li>Fix timeout error firing even though it's cancelled (<a
class="issue-link js-issue-link" data-error-text="Failed to load title"
data-id="2820369686" data-permission-text="Title is private"
data-url="sindresorhus/got#2399"
data-hovercard-type="pull_request"
data-hovercard-url="/sindresorhus/got/pull/2399/hovercard"
href="https://redirect.github.com/sindresorhus/got/pull/2399">#2399</a>)
<a class="commit-link" data-hovercard-type="commit"
data-hovercard-url="https://github.com/sindresorhus/got/commit/7a920647efa236bd1f80dad087a27371e5070f7b/hovercard"
href="https://redirect.github.com/sindresorhus/got/commit/7a920647efa236bd1f80dad087a27371e5070f7b"><tt>7a92064</tt></a></li>
</ul>
<p><a class="commit-link"
href="https://redirect.github.com/sindresorhus/got/compare/v14.4.5...v14.4.6"><tt>v14.4.5...v14.4.6</tt></a></p>
      </li>
      <li>
<b>14.4.5</b> - <a
href="https://redirect.github.com/sindresorhus/got/releases/tag/v14.4.5">2024-11-23</a></br><ul>
<li>Fix a crash with Got accessing a non-existent request (<a
class="issue-link js-issue-link" data-error-text="Failed to load title"
data-id="2684084125" data-permission-text="Title is private"
data-url="sindresorhus/got#2391"
data-hovercard-type="pull_request"
data-hovercard-url="/sindresorhus/got/pull/2391/hovercard"
href="https://redirect.github.com/sindresorhus/got/pull/2391">#2391</a>)
<a class="commit-link" data-hovercard-type="commit"
data-hovercard-url="https://github.com/sindresorhus/got/commit/c079b9366ff2231a806c9746f0dfb4a0ec34e5d1/hovercard"
href="https://redirect.github.com/sindresorhus/got/commit/c079b9366ff2231a806c9746f0dfb4a0ec34e5d1"><tt>c079b93</tt></a></li>
</ul>
<p><a class="commit-link"
href="https://redirect.github.com/sindresorhus/got/compare/v14.4.4...v14.4.5"><tt>v14.4.4...v14.4.5</tt></a></p>
      </li>
      <li>
<b>14.4.4</b> - <a
href="https://redirect.github.com/sindresorhus/got/releases/tag/v14.4.4">2024-11-04</a></br><ul>
<li>Fix support for <code>AbortSignal#timeout()</code> (<a
class="issue-link js-issue-link" data-error-text="Failed to load title"
data-id="2630436761" data-permission-text="Title is private"
data-url="sindresorhus/got#2388"
data-hovercard-type="pull_request"
data-hovercard-url="/sindresorhus/got/pull/2388/hovercard"
href="https://redirect.github.com/sindresorhus/got/pull/2388">#2388</a>)
<a class="commit-link" data-hovercard-type="commit"
data-hovercard-url="https://github.com/sindresorhus/got/commit/92b378e5fd95e891e849c7f3fa7483575ab052c3/hovercard"
href="https://redirect.github.com/sindresorhus/got/commit/92b378e5fd95e891e849c7f3fa7483575ab052c3"><tt>92b378e</tt></a></li>
</ul>
<p><a class="commit-link"
href="https://redirect.github.com/sindresorhus/got/compare/v14.4.3...v14.4.4"><tt>v14.4.3...v14.4.4</tt></a></p>
      </li>
      <li>
<b>14.4.3</b> - <a
href="https://redirect.github.com/sindresorhus/got/releases/tag/v14.4.3">2024-10-09</a></br><ul>
<li>Fix cache with HTTP2 (<a class="issue-link js-issue-link"
data-error-text="Failed to load title" data-id="2552780403"
data-permission-text="Title is private"
data-url="sindresorhus/got#2380"
data-hovercard-type="pull_request"
data-hovercard-url="/sindresorhus/got/pull/2380/hovercard"
href="https://redirect.github.com/sindresorhus/got/pull/2380">#2380</a>)
<a class="commit-link" data-hovercard-type="commit"
data-hovercard-url="https://github.com/sindresorhus/got/commit/f2f8cb29fe9ffcae39955f9a2591cc84cec349b7/hovercard"
href="https://redirect.github.com/sindresorhus/got/commit/f2f8cb29fe9ffcae39955f9a2591cc84cec349b7"><tt>f2f8cb2</tt></a></li>
</ul>
<p><a class="commit-link"
href="https://redirect.github.com/sindresorhus/got/compare/v14.4.2...v14.4.3"><tt>v14.4.2...v14.4.3</tt></a></p>
      </li>
      <li>
<b>14.4.2</b> - <a
href="https://redirect.github.com/sindresorhus/got/releases/tag/v14.4.2">2024-07-24</a></br><ul>
<li>Fix handling of invalid arguments (<a class="issue-link
js-issue-link" data-error-text="Failed to load title"
data-id="2426382269" data-permission-text="Title is private"
data-url="sindresorhus/got#2367"
data-hovercard-type="pull_request"
data-hovercard-url="/sindresorhus/got/pull/2367/hovercard"
href="https://redirect.github.com/sindresorhus/got/pull/2367">#2367</a>)
<a class="commit-link" data-hovercard-type="commit"
data-hovercard-url="https://github.com/sindresorhus/got/commit/f44ef4388e0b56c8b0abd30d5161fe39053e3ce8/hovercard"
href="https://redirect.github.com/sindresorhus/got/commit/f44ef4388e0b56c8b0abd30d5161fe39053e3ce8"><tt>f44ef43</tt></a></li>
</ul>
<p><a class="commit-link"
href="https://redirect.github.com/sindresorhus/got/compare/v14.4.1...v14.4.2"><tt>v14.4.1...v14.4.2</tt></a></p>
      </li>
      <li>
<b>14.4.1</b> - <a
href="https://redirect.github.com/sindresorhus/got/releases/tag/v14.4.1">2024-06-06</a></br><ul>
<li>Fix missing dependency <a class="commit-link"
data-hovercard-type="commit"
data-hovercard-url="https://github.com/sindresorhus/got/commit/dfc54d9e57b738b4447aff08940a242ec95910ae/hovercard"
href="https://redirect.github.com/sindresorhus/got/commit/dfc54d9e57b738b4447aff08940a242ec95910ae"><tt>dfc54d9</tt></a></li>
</ul>
<p><a class="commit-link"
href="https://redirect.github.com/sindresorhus/got/compare/v14.4.0...v14.4.1"><tt>v14.4.0...v14.4.1</tt></a></p>
      </li>
      <li>
<b>14.4.0</b> - <a
href="https://redirect.github.com/sindresorhus/got/releases/tag/v14.4.0">2024-06-04</a></br><ul>
<li>Improve TypeScript types with generic extend (<a class="issue-link
js-issue-link" data-error-text="Failed to load title"
data-id="2322306523" data-permission-text="Title is private"
data-url="sindresorhus/got#2353"
data-hovercard-type="pull_request"
data-hovercard-url="/sindresorhus/got/pull/2353/hovercard"
href="https://redirect.github.com/sindresorhus/got/pull/2353">#2353</a>)
<a class="commit-link" data-hovercard-type="commit"
data-hovercard-url="https://github.com/sindresorhus/got/commit/15ca4a09934ea6893f5e0828037898cc9f0cb817/hovercard"
href="https://redirect.github.com/sindresorhus/got/commit/15ca4a09934ea6893f5e0828037898cc9f0cb817"><tt>15ca4a0</tt></a></li>
</ul>
<p><a class="commit-link"
href="https://redirect.github.com/sindresorhus/got/compare/v14.3.0...v14.4.0"><tt>v14.3.0...v14.4.0</tt></a></p>
      </li>
      <li>
<b>14.3.0</b> - <a
href="https://redirect.github.com/sindresorhus/got/releases/tag/v14.3.0">2024-05-18</a></br><ul>
<li>Update dependencies <a class="commit-link"
data-hovercard-type="commit"
data-hovercard-url="https://github.com/sindresorhus/got/commit/dbab6c383204fd0e204562e5976c00fe652d61a8/hovercard"
href="https://redirect.github.com/sindresorhus/got/commit/dbab6c383204fd0e204562e5976c00fe652d61a8"><tt>dbab6c3</tt></a></li>
</ul>
<p><a class="commit-link"
href="https://redirect.github.com/sindresorhus/got/compare/v14.2.1...v14.3.0"><tt>v14.2.1...v14.3.0</tt></a></p>
      </li>
      <li>
<b>14.2.1</b> - <a
href="https://redirect.github.com/sindresorhus/got/releases/tag/v14.2.1">2024-03-07</a></br><ul>
<li>Fix error handling when UTF-8 decoding fails (<a class="issue-link
js-issue-link" data-error-text="Failed to load title"
data-id="2165540450" data-permission-text="Title is private"
data-url="sindresorhus/got#2336"
data-hovercard-type="pull_request"
data-hovercard-url="/sindresorhus/got/pull/2336/hovercard"
href="https://redirect.github.com/sindresorhus/got/pull/2336">#2336</a>)
<a class="commit-link" data-hovercard-type="commit"
data-hovercard-url="https://github.com/sindresorhus/got/commit/c81a61159473b8c12c22e00b42cac2ecdfc2ee87/hovercard"
href="https://redirect.github.com/sindresorhus/got/commit/c81a61159473b8c12c22e00b42cac2ecdfc2ee87"><tt>c81a611</tt></a></li>
</ul>
<p><a class="commit-link"
href="https://redirect.github.com/sindresorhus/got/compare/v14.2.0...v14.2.1"><tt>v14.2.0...v14.2.1</tt></a></p>
      </li>
      <li>
<b>14.2.0</b> - <a
href="https://redirect.github.com/sindresorhus/got/releases/tag/v14.2.0">2024-02-03</a></br><ul>
<li>Add <code>cause</code> property with the original error to
<code>RequestError</code> (<a class="issue-link js-issue-link"
data-error-text="Failed to load title" data-id="2106602472"
data-permission-text="Title is private"
data-url="sindresorhus/got#2327"
data-hovercard-type="pull_request"
data-hovercard-url="/sindresorhus/got/pull/2327/hovercard"
href="https://redirect.github.com/sindresorhus/got/pull/2327">#2327</a>)
<a class="commit-link" data-hovercard-type="commit"
data-hovercard-url="https://github.com/sindresorhus/got/commit/4cbd01d4ac76e005e83db6288e0f3d14b94c1ff8/hovercard"
href="https://redirect.github.com/sindresorhus/got/commit/4cbd01d4ac76e005e83db6288e0f3d14b94c1ff8"><tt>4cbd01d</tt></a></li>
</ul>
<p><a class="commit-link"
href="https://redirect.github.com/sindresorhus/got/compare/v14.1.0...v14.2.0"><tt>v14.1.0...v14.2.0</tt></a></p>
      </li>
      <li>
        <b>14.1.0</b> - 2024-01-29
      </li>
      <li>
        <b>14.0.0</b> - 2023-11-29
      </li>
      <li>
        <b>13.0.0</b> - 2023-05-27
      </li>
    </ul>
from <a href="https://redirect.github.com/sindresorhus/got/releases">got
GitHub release notes</a>
  </details>
</details>

---

> [!IMPORTANT]
>
> - **Warning:** This PR contains a major version upgrade, and may be a
breaking change.
> - Check the changes in this PR to ensure they won't cause issues with
your project.
> - This PR was automatically created by Snyk using the credentials of a
real user.

---

**Note:** _You are seeing this because you or someone else with access
to this repository has authorized Snyk to open upgrade PRs._

**For more information:** <img
src="https://api.segment.io/v1/pixel/track?data=eyJ3cml0ZUtleSI6InJyWmxZcEdHY2RyTHZsb0lYd0dUcVg4WkFRTnNCOUEwIiwiYW5vbnltb3VzSWQiOiI4NjcwNDQ3Zi1lNDZiLTRjZTktOTQ5Yi0wMzJlNTZmNDY4N2YiLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6Ijg2NzA0NDdmLWU0NmItNGNlOS05NDliLTAzMmU1NmY0Njg3ZiJ9fQ=="
width="0" height="0"/>

> - 🧐 [View latest project
report](https://app.snyk.io/org/graysonbarton/project/98d5f3ab-6a8e-4202-a47c-1fa6e417fe48?utm_source&#x3D;github-cloud-app&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)
> - 📜 [Customise PR
templates](https://docs.snyk.io/scan-using-snyk/pull-requests/snyk-fix-pull-or-merge-requests/customize-pr-templates?utm_source=&utm_content=fix-pr-template)
> - 🛠 [Adjust upgrade PR
settings](https://app.snyk.io/org/graysonbarton/project/98d5f3ab-6a8e-4202-a47c-1fa6e417fe48/settings/integration?utm_source&#x3D;github-cloud-app&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)
> - 🔕 [Ignore this dependency or unsubscribe from future upgrade
PRs](https://app.snyk.io/org/graysonbarton/project/98d5f3ab-6a8e-4202-a47c-1fa6e417fe48/settings/integration?pkg&#x3D;got&amp;utm_source&#x3D;github-cloud-app&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr#auto-dep-upgrades)

[//]: #
'snyk:metadata:{"customTemplate":{"variablesUsed":[],"fieldsUsed":[]},"dependencies":[{"name":"got","from":"13.0.0","to":"14.4.6"}],"env":"prod","hasFixes":false,"isBreakingChange":true,"isMajorUpgrade":true,"issuesToFix":[],"prId":"8670447f-e46b-4ce9-949b-032e56f4687f","prPublicId":"8670447f-e46b-4ce9-949b-032e56f4687f","packageManager":"npm","priorityScoreList":[],"projectPublicId":"98d5f3ab-6a8e-4202-a47c-1fa6e417fe48","projectUrl":"https://app.snyk.io/org/graysonbarton/project/98d5f3ab-6a8e-4202-a47c-1fa6e417fe48?utm_source=github-cloud-app&utm_medium=referral&page=upgrade-pr","prType":"upgrade","templateFieldSources":{"branchName":"default","commitMessage":"default","description":"default","title":"default"},"templateVariants":[],"type":"auto","upgrade":[],"upgradeInfo":{"versionsDiff":12,"publishedDate":"2025-02-10T07:54:24.295Z"},"vulns":[]}'

## Summary by Sourcery

Upgrade the got dependency from version 13.0.0 to 14.4.6.
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.

Url not checked
2 participants
0