Skip to content

When previousMiddleware returns body middleware does not return #10

@vincentdigital

Description

@vincentdigital

Hey all,

I found that when I pass previousMiddleware to instantiate the middleware, like so;

  const redirectionIoMiddleware = createRedirectionIoMiddleware({
    previousMiddleware: localMiddleware,
    mode: "full",
    logged: true,
  });

where localMiddleware returns something like this:

  return NextResponse.json(
    { message: "test" },
    {
      status: 200,
    }
  );

that the redirection.io middleware still processes and not just returns the response from the earlier middleware as I would expect. Given that middleware are allowed to also return a full response according to next.js docs, I would say this is a bug. Any considerations or thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions