Files
JJ KasperandGitHub d3a9f5a54a Fix trailing slash redirect applying for data request (#45417)
This ensures we don't apply the trailing slash redirect for `_next/data`
requests as it can cause props to fail to resolve on client transition.
This also fixes `missing` fields not being applied correctly for
`headers` and `redirects` as the field wasn't being passed through.

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

Closes: https://github.com/vercel/next.js/pull/45398
Fixes: https://github.com/vercel/next.js/issues/45393
x-ref: https://github.com/vercel/next.js/issues/45340
2023-01-30 12:10:30 -08:00

28 lines
576 B
TypeScript

import { GetServerSideProps } from 'next'
import React from 'react'
export interface ProductPageProps {
test: string
}
const ProductPage = (params: ProductPageProps) => {
return (
<>
<h1 id="text">Param found: {params.test}</h1>
</>
)
}
export const getServerSideProps: GetServerSideProps = async ({ params }) => {
const joined = Array.isArray(params['product-params'])
? params['product-params'].join(', ')
: params['product-params']
return {
props: {
test: joined ? joined : 'Not Found',
},
}
}
export default ProductPage