Skip to content

test: prevent test middleware from crashing on GET requests in Express 5#1167

Draft
ericcrosson-bitgo wants to merge 6 commits into
masterfrom
ericcrosson/ai-782-fix-express-and-typesexpress-dependency-bump-test
Draft

test: prevent test middleware from crashing on GET requests in Express 5#1167
ericcrosson-bitgo wants to merge 6 commits into
masterfrom
ericcrosson/ai-782-fix-express-and-typesexpress-dependency-bump-test

Conversation

@ericcrosson-bitgo

Copy link
Copy Markdown
Contributor

Updates appMiddleware in express-wrapper and typed-express-router test suites to check if req.body is defined before setting the appMiddlewareRan flag.

In Express 5, req.body defaults to undefined on requests without a body (such as GET requests), which caused these test suites to throw a TypeError and fail.

Closes Ticket: AI-782

@linear-code

linear-code Bot commented Jul 24, 2026

Copy link
Copy Markdown

AI-782

dependabot Bot and others added 6 commits July 24, 2026 11:18
Bumps [express](https://github.com/expressjs/express) and [@types/express](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/express). These dependencies needed to be updated together.

Updates `express` from 4.21.2 to 5.2.1
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/master/History.md)
- [Commits](expressjs/express@4.21.2...v5.2.1)

Updates `@types/express` from 4.17.21 to 5.0.6
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/express)

---
updated-dependencies:
- dependency-name: "@types/express"
  dependency-version: 5.0.6
  dependency-type: direct:production
  update-type: version-update:semver-major
- dependency-name: express
  dependency-version: 5.2.1
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Express 5 upgrades req.body to undefined by default on GET/empty body
requests. Our test appMiddleware previously assumed req.body was always
an object, causing TypeError on GET routes during test runs.

We add a defensive check for req.body presence so tests can pass when
upgrading to Express 5 dependencies.

Ticket: AI-782
…Dependencies

Declares express and @types/express as peerDependencies supporting both
v4 and v5 ranges, and adds them to devDependencies to preserve local development.

Ticket: AI-782
…dencies

Declares express and @types/express as peerDependencies supporting both
v4 and v5 ranges, and adds express to devDependencies to preserve local development.

Ticket: AI-782
Regenerates lockfile structure following the shift of express and
@types/express to peerDependencies and devDependencies in workspaces.

Ticket: AI-782
Adds express-version (4 and 5) to the GitHub Actions workflow matrix, and
installs the corresponding target version in the workspaces before test execution.

Ticket: AI-782
@ericcrosson-bitgo
ericcrosson-bitgo force-pushed the ericcrosson/ai-782-fix-express-and-typesexpress-dependency-bump-test branch from 353c176 to e11b1ba Compare July 24, 2026 16:18
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.

1 participant