Skip to content

Update koa 2.16.1 → 3.0.0 (major) - #566

Merged
canova merged 1 commit into
masterfrom
depfu/update/yarn/koa-3.0.0
May 7, 2025
Merged

Update koa 2.16.1 → 3.0.0 (major)#566
canova merged 1 commit into
masterfrom
depfu/update/yarn/koa-3.0.0

Conversation

@depfu

@depfudepfuBot commented May 6, 2025

Copy link
Copy Markdown
Contributor

Here is everything you need to know about this upgrade. Please take a good look at what changed and the test results before merging this pull request.

What changed?

✳️ koa (2.16.1 → 3.0.0) · Repo · Changelog

Release Notes

3.0.0

This is a major release.

Breaking

  • Minimum node v18
  • Removes .redirect('back'), adds .back(fallback_url)@fl0w#1115
  • For .redirect(), don't render redirect values in anchor ref ff25eb4
  • req.origin should display the origin header if it exists, not the current hostname #1008. origin now aligns with the Origin header as used in CORS.
  • .body=<json> should not overwrite type if type already json #1120
  • Remove special ENOENT support #1861 - this is a big change and will require any file servers to adapt to this change for handling 404s / files not found
  • Removes generator deprecation messages. Generators are no longer supported. Koa no longer asserts if generators are used.
    Set content-length: 0 if body is explicitly set to null @ognjenjevremovic#1528
    Remove obsolete createAsyncCtxStorageMiddleware #1817
  • ctx.throw now requires a format of ctx.throw(status, error, properties). See: https://www.npmjs.com/package/http-errors

New

  • Support custom streams @KristapsR#1825
  • Support WHATWG response bodies #1830@kravorkid
  • Use asyncLocalStorage to get current context from app, e.g.: const ctx = app.currentContext.

Fixes

  • Handle responses when socket is no longer writable @titanism@Azlond#1593
  • fix: Do not response Content-Length if Transfer-Encoding is defined #1562@charlyzeng
  • fix: Set body to 'null' if ctx.type = 'json' and ctx.body = null#1059@likegun
  • fix: can not get currentContext in error handler (#1758) (Gxkl <gxkl203@gmail.com>)
  • Fix exports.defaults in package.json #1630
  • Fix leaky handles in tests #1838
  • Fix body null checks #1814
  • Fix reformatting redirect URLs #1805#1804
  • Fix passing ctx in error handler #1758
  • Avoid redos on host and protocol getter

Refactors

Dependencies

  • bump type-is@2
  • bump http-errors@2
  • bump cookies@0.9.1
  • bump statuses@2
  • bump supertest@7

Does any of this look wrong? Please let us know.

Commits

See the full diff on Github. The new version differs by more commits than we can show here.


Depfu Status

Depfu will automatically keep this PR conflict-free, as long as you don't add any commits to this branch yourself. You can also trigger a rebase manually by commenting with @depfu rebase.

All Depfu comment commands
@​depfu rebase
Rebases against your default branch and redoes this update
@​depfu recreate
Recreates this PR, overwriting any edits that you've made to it
@​depfu merge
Merges this PR once your tests are passing and conflicts are resolved
@​depfu cancel merge
Cancels automatic merging of this PR
@​depfu close
Closes this PR and deletes the branch
@​depfu reopen
Restores the branch and reopens this PR (if it's closed)
@​depfu pause
Ignores all future updates for this dependency and closes this PR
@​depfu pause [minor|major]
Ignores all future minor/major updates for this dependency and closes this PR
@​depfu resume
Future versions of this dependency will create PRs again (leaves this PR as is)

@depfudepfuBot added the dependencies Pull requests that update a dependency file label May 6, 2025
@depfu
depfuBot requested review from canova and julienwMay 6, 2025 02:33

@canovacanova left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Bumps the min node version to v18. And the other breaking changes look fine. Testing locally seems to work too.

I seem to get this node warning:

(node:52431) [DEP0048] DeprecationWarning: The `util.isError` API is deprecated. Please use `ObjectPrototypeToString(e) === "[object Error]" || e instanceof Error` instead.

But I get it without this patch too... But it's not a hard error, and not so sure where it comes from exactly. We don't have any util.isError in the source code, so it must be from one of the libraries.

@canova
canova merged commit 5350acd into masterMay 7, 2025
@depfu
depfuBot deleted the depfu/update/yarn/koa-3.0.0 branch May 7, 2025 11:24
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependenciesPull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@canova