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

Allow reading request bodies in middlewares #34294

Merged
merged 7 commits into from Feb 17, 2022

Conversation

Schniz
Copy link
Contributor

@Schniz Schniz commented Feb 13, 2022

Related:

packages/next/package.json Outdated Show resolved Hide resolved
@ijjk

This comment has been minimized.

@ijjk

This comment has been minimized.

@Schniz Schniz marked this pull request as ready for review Feb 14, 2022
@ijjk

This comment has been minimized.

@ijjk

This comment has been minimized.

@ijjk

This comment has been minimized.

@ijjk

This comment has been minimized.

@ijjk

This comment has been minimized.

@ijjk

This comment has been minimized.

@ijjk

This comment has been minimized.

@ijjk
Copy link
Member

@ijjk ijjk commented Feb 14, 2022

Failing test suites

Commit: 04177b8

yarn testheadless test/integration/ondemand/test/index.test.js

  • On Demand Entries > should navigate to pages with dynamic imports
Expand output

● On Demand Entries › should navigate to pages with dynamic imports

TIMED OUT: /Hello/

/nav/dynamic

  474 |
  475 |   if (hardError) {
> 476 |     throw new Error('TIMED OUT: ' + regex + '\n\n' + content)
      |           ^
  477 |   }
  478 |   return false
  479 | }

  at Object.check (lib/next-test-utils.js:476:11)
  at Object.<anonymous> (integration/ondemand/test/index.test.js:128:7)

Read more about building and testing Next.js in contributing.md.

beforeAll(async () => {
next = await createNext({
files: {
'pages/_middleware.js': `
Copy link
Member

@ijjk ijjk Feb 14, 2022

Choose a reason for hiding this comment

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

Can we add a test case where the middleware reads the body but then continues to an API route that returns the body from req.body?

Copy link
Contributor Author

@Schniz Schniz Feb 15, 2022

Choose a reason for hiding this comment

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

good idea

Copy link
Contributor Author

@Schniz Schniz Feb 15, 2022

Choose a reason for hiding this comment

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

🧑‍🚀 ⏲️

@Schniz Schniz marked this pull request as draft Feb 15, 2022
@ijjk

This comment has been minimized.

@ijjk

This comment has been minimized.

packages/next/server/next-server.ts Outdated Show resolved Hide resolved
@Schniz Schniz marked this pull request as ready for review Feb 15, 2022
@Schniz Schniz requested a review from ijjk Feb 15, 2022
@ijjk

This comment has been minimized.

@ijjk ijjk requested a review from javivelasco Feb 15, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants