Commit Graph

1222 Commits

Author SHA1 Message Date
Jan Kaiser
399cb6b0dd fix missing cleanup, if response socket is no longer writeable (issue 1547) (#1593)
Relates to issue #1547, see my [comment
there](https://github.com/koajs/koa/issues/1547#issuecomment-908370552)

Co-authored-by: Jan Kaiser <jan.kaiser@boerse-go.de>
Co-authored-by: titanism <101466223+titanism@users.noreply.github.com>
2025-02-26 23:28:52 -06:00
fengmk2
5054af6e31 Merge commit from fork
* fix: avoid redos on host and protocol getter

Only effect on app.proxy enable

closes https://github.com/koajs/koa/security/advisories/GHSA-593f-38f6-jp5m

* 3.0.0-alpha.3
2025-02-12 10:14:18 +08:00
jongleberry
71902b1f21 3.0.0-alpha.2 2024-11-03 21:08:13 -08:00
Imed Jaberi
4c34546413 deps: update http-errors to v2.0.0 (#1486)
- https://github.com/jshttp/http-errors/blob/master/HISTORY.md
2024-11-03 20:52:31 -08:00
Vlad Sirenko
ce6b3b6eee Use node test runner (#1845)
## Checklist
use `node --test` instead of `jest`
See: https://github.com/koajs/koa/issues/1837#issuecomment-2323002820

- [X] I have ensured my pull request is not behind the main or master
branch of the original repository.
- [X] I have rebased all commits where necessary so that reviewing this
pull request can be done without having to merge it first.
- [X] I have written a commit message that passes commitlint linting.
- [X] I have ensured that my code changes pass linting tests.
- [X] I have ensured that my code changes pass unit tests.
- [X] I have described my pull request and the reasons for code changes
along with context if necessary.
2024-10-27 22:04:24 -05:00
Michal Martinek
988ebec9b4 ⬆️ cookies@0.9.1 (#1846)
## Checklist

- [x] I have ensured my pull request is not behind the main or master
branch of the original repository.
- [x] I have rebased all commits where necessary so that reviewing this
pull request can be done without having to merge it first.
- [x] I have written a commit message that passes commitlint linting.
- [x] I have ensured that my code changes pass linting tests.
- [x] I have ensured that my code changes pass unit tests.
- [x] I have described my pull request and the reasons for code changes
along with context if necessary.

## Maintainer Notes

Closes https://github.com/koajs/koa/issues/1561
2024-10-22 13:39:59 -05:00
Martin Iwanowski
f9f7714e95 response.redirect: extract special-cased back, fixes #904 (#1115)
The simple solution to drop special-cased `'back'` in
`response.redirect`.
I can't label but should be labeled as version-major.

This PR **does not** make use of Symbol as purposed in #904.

**Edit**
If this solution is acceptable, a deprecation should be added to Koa 2
on `'back'` use.

---------

Co-authored-by: Kevin Peno <kjpeno@outlook.com>
2024-10-20 16:41:19 -07:00
Jeremy Daley
ff0f3b642a Added exports.default to package.json (#1630)
Per NodeJS documentation on the `package.json` `exports` object, there
seems to be a need for a fallback `default` key:
https://nodejs.org/api/packages.html#conditional-exports

Additionally, I'm seeing things like eslint fail to resolve until a
`default` key has been specified. I've not dug any further into why, but
I think _some_ default should be defined until more options should later
be added.
2024-10-20 16:40:58 -07:00
jongleberry
7aad3d38bc docs: add an SSE example 2024-08-31 11:23:31 -07:00
jongleberry
0d9f062aa8 ⬆️ statuses@2.0.1
commit 84c89f25b880cf648044e2d0eeb14f9a43e1f2c9
Author: jongleberry <jonathanrichardong@gmail.com>
Date:   Sat Aug 31 11:02:37 2024 -0700

    package-lock++

commit 2c7715c797473d463ed73542d68e634f172dc3c3
Merge: 5af69c8 b95dfcb
Author: jongleberry <jonathanrichardong@gmail.com>
Date:   Sat Aug 31 10:56:58 2024 -0700

    Merge branch 'master' into update-statuses-to-v2.0.0

commit 5af69c87926db6f491af2b8882c07d7d141fe422
Author: imed jaberi <imed.jaberi@hotmail.fr>
Date:   Sat Apr 2 14:47:43 2022 +0100

    fix tests

commit 9af4bb37db0be416cd9e211ef4fc52f57de0cb69
Author: imed jaberi <imed.jaberi@hotmail.fr>
Date:   Sat Apr 2 14:43:51 2022 +0100

    lint code

commit 140be25c88d7641ce7cfc1463889d437e3cb939d
Author: imed jaberi <imed.jaberi@hotmail.fr>
Date:   Sat Apr 2 14:42:10 2022 +0100

    clean locks ---force

commit bc553ec713b16c1fe4d6a400637ab30590c176d2
Author: imed jaberi <imed.jaberi@hotmail.fr>
Date:   Sat Apr 2 14:35:12 2022 +0100

    clean locks

commit 3d7e22aef781820f7d611ad64f7622a7258e2c6d
Merge: ff65ef6 f3c67d9
Author: imed jaberi <imed.jaberi@hotmail.fr>
Date:   Sat Apr 2 14:31:30 2022 +0100

    resolve conflicts

commit ff65ef6c6b19c7f307726bae22eb8154894a14dc
Author: 3imed-jaberi <imed_jebari@hotmail.fr>
Date:   Tue Jul 14 10:52:50 2020 +0200

     deps: use the new statuses api --ctx --response --test

commit f565f3b732a6550a74506c480319e6efe4b51da7
Author: 3imed-jaberi <imed_jebari@hotmail.fr>
Date:   Tue Jul 14 10:52:31 2020 +0200

     deps: use the new statuses api --ctx --response --src

commit e8f7609ca405904fabc6669fa31be0df1c9ada55
Author: 3imed-jaberi <imed_jebari@hotmail.fr>
Date:   Tue Jul 14 10:50:49 2020 +0200

     deps: update statuses >> v2.0.0
2024-08-31 11:05:25 -07:00
jongleberry
c62a0a965b test: remove leaky handles (#1838) 2024-08-31 11:04:07 -07:00
jongleberry
b95dfcb8ed docs: add note about features in koa-vs-express
closes #1654
2024-08-30 21:57:15 -07:00
jongleberry
51d0e2deca ⬆️ jest@29 (#1839) 2024-08-30 21:52:45 -07:00
jongleberry
ba9a222382 ⬆️ supertest@7 (#1841) 2024-08-30 21:52:36 -07:00
Matthieu Tabarin
7cf1462d34 Feat: Replace node querystring with URLSearchParams (#1828)
Fix #1570 Replace node querystring with URLSearchParams it mimics the
way that querystring works

## Checklist

- [x] I have ensured my pull request is not behind the main or master
branch of the original repository.
- [x] I have rebased all commits where necessary so that reviewing this
pull request can be done without having to merge it first.
- [x] I have written a commit message that passes commitlint linting.
- [x] I have ensured that my code changes pass linting tests.
- [x] I have ensured that my code changes pass unit tests.
- [x] I have described my pull request and the reasons for code changes
along with context if necessary.
2024-08-30 21:50:02 -07:00
jongleberry
d0f8543824 docs: add example of using an HTTP2, closes #1833 2024-08-30 21:45:06 -07:00
jongleberry
056ae99c75 github actions: continue on error for codecov 2024-08-30 21:40:19 -07:00
jongleberry
eab4f0cc57 github actions: test node@22 2024-08-30 21:39:43 -07:00
dependabot[bot]
2281cadfd9 build(deps-dev): bump braces from 3.0.2 to 3.0.3 (#1822)
Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to
3.0.3.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="74b2db2938"><code>74b2db2</code></a>
3.0.3</li>
<li><a
href="88f1429a0f"><code>88f1429</code></a>
update eslint. lint, fix unit tests.</li>
<li><a
href="415d660c30"><code>415d660</code></a>
Snyk js braces 6838727 (<a
href="https://redirect.github.com/micromatch/braces/issues/40">#40</a>)</li>
<li><a
href="190510f79d"><code>190510f</code></a>
fix tests, skip 1 test in test/braces.expand</li>
<li><a
href="716eb9f12d"><code>716eb9f</code></a>
readme bump</li>
<li><a
href="a5851e57f4"><code>a5851e5</code></a>
Merge pull request <a
href="https://redirect.github.com/micromatch/braces/issues/37">#37</a>
from coderaiser/fix/vulnerability</li>
<li><a
href="2092bd1fb1"><code>2092bd1</code></a>
feature: braces: add maxSymbols (<a
href="https://github.com/micromatch/braces/issues/">https://github.com/micromatch/braces/issues/</a>...</li>
<li><a
href="9f5b4cf473"><code>9f5b4cf</code></a>
fix: vulnerability (<a
href="https://security.snyk.io/vuln/SNYK-JS-BRACES-6838727">https://security.snyk.io/vuln/SNYK-JS-BRACES-6838727</a>)</li>
<li><a
href="98414f9f1f"><code>98414f9</code></a>
remove funding file</li>
<li><a
href="665ab5d561"><code>665ab5d</code></a>
update keepEscaping doc (<a
href="https://redirect.github.com/micromatch/braces/issues/27">#27</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/micromatch/braces/compare/3.0.2...3.0.3">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=braces&package-manager=npm_and_yarn&previous-version=3.0.2&new-version=3.0.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

You can trigger a rebase of this PR by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts page](https://github.com/koajs/koa/network/alerts).

</details>

> **Note**
> Automatic rebases have been disabled on this pull request as it has
been open for over 30 days.

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-18 13:27:08 -07:00
Evgenii Troinov
e7a325d6d7 Changehange node.js version in readme.md from 12.x to 18.x (#1823)
## Checklist

- [x] I have ensured my pull request is not behind the main or master
branch of the original repository.
- [x] I have rebased all commits where necessary so that reviewing this
pull request can be done without having to merge it first.
- [x] I have written a commit message that passes commitlint linting.
- [x] I have ensured that my code changes pass linting tests.
- [x] I have ensured that my code changes pass unit tests.
- [x] I have described my pull request and the reasons for code changes
along with context if necessary.
2024-08-18 13:19:58 -07:00
dependabot[bot]
5bf8002d7b build(deps): bump debug from 4.3.4 to 4.3.6 (#1836)
Bumps [debug](https://github.com/debug-js/debug) from 4.3.4 to 4.3.6.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/debug-js/debug/releases">debug's
releases</a>.</em></p>
<blockquote>
<h2>4.3.6</h2>
<h2>What's Changed</h2>
<ul>
<li>Avoid using deprecated RegExp.$1 by <a
href="https://github.com/bluwy"><code>@​bluwy</code></a> in <a
href="https://redirect.github.com/debug-js/debug/pull/969">debug-js/debug#969</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/bluwy"><code>@​bluwy</code></a> made
their first contribution in <a
href="https://redirect.github.com/debug-js/debug/pull/969">debug-js/debug#969</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/debug-js/debug/compare/4.3.5...4.3.6">https://github.com/debug-js/debug/compare/4.3.5...4.3.6</a></p>
<h2>4.3.5</h2>
<h1>Patch</h1>
<ul>
<li>cac39b1c5b018b0fe93a53a05f084eee543d17f5 Fix/debug depth (<a
href="https://redirect.github.com/debug-js/debug/issues/926">#926</a>)</li>
</ul>
<p>Thank you <a
href="https://github.com/calvintwr"><code>@​calvintwr</code></a> for the
fix.</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="c33b464a79"><code>c33b464</code></a>
4.3.6</li>
<li><a
href="7956a45f68"><code>7956a45</code></a>
Avoid using deprecated RegExp.$1</li>
<li><a
href="5464bdddbc"><code>5464bdd</code></a>
4.3.5</li>
<li><a
href="f244ada2e9"><code>f244ada</code></a>
update authorship contact info</li>
<li><a
href="cac39b1c5b"><code>cac39b1</code></a>
Fix/debug depth (<a
href="https://redirect.github.com/debug-js/debug/issues/926">#926</a>)</li>
<li><a
href="f66cb2d9f7"><code>f66cb2d</code></a>
remove .github folder (and the outdated issue templates)</li>
<li><a
href="d1616622e4"><code>d161662</code></a>
Update ISSUE_TEMPLATE.md</li>
<li><a
href="12c1ad04db"><code>12c1ad0</code></a>
Update ISSUE_TEMPLATE.md</li>
<li>See full diff in <a
href="https://github.com/debug-js/debug/compare/4.3.4...4.3.6">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=debug&package-manager=npm_and_yarn&previous-version=4.3.4&new-version=4.3.6)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-18 13:16:44 -07:00
Tommy Dew
cfdb77f34d docs: Add writable getter to the response doc (#1832)
Fixes #1680
2024-06-28 23:26:17 +08:00
Matthieu Tabarin
8d5beb329d feat: add support web WHATWG (#1830)
closes https://github.com/koajs/koa/issues/1777
2024-06-28 22:45:36 +08:00
Matthieu Tabarin
757e4ebc51 deps: make "only" package inside (#1824)
closes https://github.com/koajs/koa/issues/1802
2024-06-20 12:26:12 +08:00
Leslie
b89e19a275 fix: improve body null check (#1814) 2024-05-30 09:02:33 +08:00
十叶
00f3fed66d doc: add partitioned and priority for cookies (#1816)
sync latest cookie options
2024-05-30 09:00:30 +08:00
andrew0
5bc0b46516 fix: remove unused async local storage middleware (#1817)
This middleware was made obsolete by e98b8d1.
2024-05-30 08:59:19 +08:00
Evgenii Troinov
5573b966a6 feat: Drop node.js 12.x, 14.x, 17.x support (#1797) 2024-04-22 14:25:10 +08:00
Dana Sommerich
6fbc40b222 docs: Fix definition of middleware in guide.md (#1810) 2024-04-22 14:23:25 +08:00
Leslie
f85214a5bd docs: Modify options type in the Application class (#1812) 2024-04-22 14:22:59 +08:00
dependabot[bot]
6bd2cb18dd build(deps): bump encodeurl from 1.0.2 to 2.0.0 (#1807)
Bumps [encodeurl](https://github.com/pillarjs/encodeurl) from 1.0.2 to 2.0.0.
- [Release notes](https://github.com/pillarjs/encodeurl/releases)
- [Commits](https://github.com/pillarjs/encodeurl/compare/v1.0.2...v2.0.0)

---
updated-dependencies:
- dependency-name: encodeurl
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-29 18:13:23 -07:00
FDrag0n
185e701a8a fix: handle upper case protocol like HTTP or HTTPS (#1805)
Co-authored-by: fengmk2 <suqian.yf@antgroup.com>
2024-03-21 16:23:36 +08:00
fengmk2
435534aa08 fix: formatting redirect url on http(s) protocol url (#1804)
closes https://github.com/koajs/koa/issues/1800

pick from https://github.com/koajs/koa/pull/1803
2024-03-15 15:19:01 +08:00
LaicZhang
5f159415e5 test: Add Node.js 20 (#1788) 2024-01-17 10:02:10 +08:00
Evgenii Troinov
ac61b8ca12 chore: Replacing eslint with standard cli (#1796) 2024-01-17 10:01:07 +08:00
那里好脏不可以
5ba533f831 chore: fix jsdoc and typo (#1662) 2023-11-08 23:05:20 +08:00
hustLer2k
ec912a3db7 docs: add missing entries to response aliases in context.md (#1769) 2023-10-31 21:09:26 +08:00
hustLer2k
814a2a5f62 docs: fix response.vary jsdoc field param (#1767) 2023-10-31 21:08:41 +08:00
宋昆达
dbf4b8f412 docs: fix node quickly install with nvm (#1760)
update `nvm install  7 ` to `nvm install 12`
2023-05-17 15:50:49 +08:00
fengmk2
632a803138 Release 3.0.0-alpha.1 2023-04-12 17:49:59 +08:00
Gxkl
e98b8d1918 fix: can not get currentContext in error handler (#1758) 2023-04-12 17:47:09 +08:00
fengmk2
bec13ecccd Release 3.0.0-alpha.0 (#1720)
publish with experimental tag
2023-01-02 14:55:07 +08:00
sjfkai
14dec599b4 fix: typo in comment (#1730) 2022-12-28 09:44:46 +08:00
dependabot[bot]
6134b3c8bf build(deps-dev): bump supertest from 6.3.2 to 6.3.3 (#1727)
Bumps [supertest](https://github.com/visionmedia/supertest) from 6.3.2 to 6.3.3.
- [Release notes](https://github.com/visionmedia/supertest/releases)
- [Commits](https://github.com/visionmedia/supertest/compare/v6.3.2...v6.3.3)

---
updated-dependencies:
- dependency-name: supertest
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-09 13:49:41 +08:00
mihailik
edc35ac722 docs: Provide more typings for application's context and request/response (#1726)
A bit more detailed types to help users of the library
2022-12-07 22:41:33 +08:00
fengmk2
9d2afef286 fix: should export createAsyncCtxStorageMiddleware function (#1725)
pick from https://github.com/koajs/koa/pull/1724
2022-12-07 15:06:01 +08:00
fengmk2
d7894c88a5 refactor: use asyncLocalStorage.run (#1718) 2022-12-06 11:33:47 +08:00
fengmk2
a0148c1f01 Revert "build(deps-dev): bump jest from 28.1.3 to 29.3.1 (#1709)" (#1719)
This reverts commit d2b09439b7.
2022-12-06 11:31:39 +08:00
dependabot[bot]
d2b09439b7 build(deps-dev): bump jest from 28.1.3 to 29.3.1 (#1709)
Bumps [jest](https://github.com/facebook/jest/tree/HEAD/packages/jest) from 28.1.3 to 29.3.1.
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/commits/v29.3.1/packages/jest)

---
updated-dependencies:
- dependency-name: jest
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-12-06 10:39:09 +08:00
Hrvoje Šimić
b3fffc06cd docs: fix grammar in koa vs express doc (#1068) 2022-12-06 10:28:51 +08:00