Skip to content

Commit 35f5edf

Browse files
committed
Run codemod middleware-to-proxy on test/e2e
1 parent b3959cd commit 35f5edf

File tree

79 files changed

+84
-89
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+84
-89
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { NextResponse } from 'next/server'
22

3-
export function middleware() {
3+
export function proxy() {
44
return NextResponse.next()
55
}

test/e2e/app-dir/actions-navigation/middleware.js renamed to test/e2e/app-dir/actions-navigation/proxy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { NextResponse } from 'next/server'
22

3-
export function middleware(request) {
3+
export function proxy(request) {
44
if (request.nextUrl.pathname.startsWith('/middleware-redirect')) {
55
return NextResponse.redirect(new URL('/action-after-redirect', request.url))
66
}

test/e2e/app-dir/actions/middleware.js renamed to test/e2e/app-dir/actions/proxy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Ensure that https://github.com/vercel/next.js/issues/56286 is fixed.
22
import { NextResponse } from 'next/server'
33

4-
export async function middleware(req) {
4+
export async function proxy(req) {
55
if (req.nextUrl.pathname.includes('rewrite-to-static-first')) {
66
req.nextUrl.pathname = '/static/first'
77
return NextResponse.rewrite(req.nextUrl)

test/e2e/app-dir/app-css/middleware.js renamed to test/e2e/app-dir/app-css/proxy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { NextResponse } from 'next/server'
22

3-
export async function middleware(request) {
3+
export async function proxy(request) {
44
// This middleware is used to test Suspensey CSS
55
if (
66
request.url.includes('_next/static/css/app/suspensey-css/slow/page.css')
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { respond } from 'compat-next-server-module'
22

3-
export async function middleware(request) {
3+
export async function proxy(request) {
44
return await respond()
55
}

test/e2e/app-dir/app-middleware/middleware.js renamed to test/e2e/app-dir/app-middleware/proxy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { headers as nextHeaders, draftMode } from 'next/headers'
55
/**
66
* @param {import('next/server').NextRequest} request
77
*/
8-
export async function middleware(request) {
8+
export async function proxy(request) {
99
const headersFromRequest = new Headers(request.headers)
1010
// It should be able to import and use `headers` inside middleware
1111
const headersFromNext = await nextHeaders()

test/e2e/app-dir/app/middleware.js renamed to test/e2e/app-dir/app/proxy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { NextResponse } from 'next/server'
55
* @param {import('next/server').NextRequest} request
66
* @returns {Promise<NextResponse | undefined>}
77
*/
8-
export async function middleware(request) {
8+
export async function proxy(request) {
99
if (request.nextUrl.pathname === '/searchparams-normalization-bug') {
1010
const headers = new Headers(request.headers)
1111
headers.set('test', request.nextUrl.searchParams.get('val') || '')

test/e2e/app-dir/cache-components-dynamic-imports/bundled/middleware.ts renamed to test/e2e/app-dir/cache-components-dynamic-imports/bundled/proxy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { ProxyConfig } from 'next/server'
22

3-
export default async function middleware() {
3+
export default async function proxy() {
44
// This import should not be instrumented.
55
// `trackDynamicImport` will throw if it's used in the edge runtime,
66
// so it's enough to just do an import() here and see if it succeeds.

test/e2e/app-dir/cache-components/middleware.ts renamed to test/e2e/app-dir/cache-components/proxy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { NextRequest } from 'next/server'
22
import { NextResponse } from 'next/server'
33

4-
export function middleware(request: NextRequest) {
4+
export function proxy(request: NextRequest) {
55
// Clone the request headers and set a new header `x-hello-from-middleware1`
66
const requestHeaders = new Headers(request.headers)
77
requestHeaders.set('x-sentinel', 'hello')

test/e2e/app-dir/draft-mode-middleware/middleware.ts renamed to test/e2e/app-dir/draft-mode-middleware/proxy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { NextResponse, type NextRequest } from 'next/server'
22
import { draftMode } from 'next/headers'
33

4-
export async function middleware(req: NextRequest) {
4+
export async function proxy(req: NextRequest) {
55
const { isEnabled } = await draftMode()
66
console.log('draftMode().isEnabled from middleware:', isEnabled)
77
return NextResponse.next()

0 commit comments

Comments
 (0)