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

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 February 14, 2022 13:14
@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 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

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

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

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 February 15, 2022 11:13
@ijjk

This comment has been minimized.

@ijjk

This comment has been minimized.

@Schniz Schniz marked this pull request as ready for review February 15, 2022 16:22
@Schniz Schniz requested a review from ijjk February 15, 2022 16:22
@ijjk

This comment has been minimized.

@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.

Middleware in API have a null body on POST Requests
4 participants