Buckets:
silverwolf-x/project / test /e2e /app-dir /app-static /app /variable-revalidate /post-method /page.js
| import { fetchRetry } from '../../../lib/fetch-retry' | |
| export const dynamic = 'force-dynamic' | |
| export default async function Page() { | |
| const data = await fetchRetry( | |
| 'https://next-data-api-endpoint.vercel.app/api/random', | |
| { | |
| method: 'POST', | |
| next: { | |
| revalidate: 10, | |
| }, | |
| } | |
| ).then((res) => res.text()) | |
| const dataWithBody1 = await fetchRetry( | |
| 'https://next-data-api-endpoint.vercel.app/api/random', | |
| { | |
| method: 'POST', | |
| body: JSON.stringify({ hello: 'world' }), | |
| next: { | |
| revalidate: 10, | |
| }, | |
| } | |
| ).then((res) => res.text()) | |
| const dataWithBody2 = await fetchRetry( | |
| 'https://next-data-api-endpoint.vercel.app/api/random', | |
| { | |
| method: 'POST', | |
| body: new ReadableStream({ | |
| start(controller) { | |
| controller.enqueue(JSON.stringify({ another: 'one' })) | |
| controller.close() | |
| }, | |
| }), | |
| duplex: 'half', | |
| next: { | |
| revalidate: 10, | |
| }, | |
| } | |
| ).then((res) => res.text()) | |
| const dataWithBody3 = await fetchRetry( | |
| 'https://next-data-api-endpoint.vercel.app/api/random', | |
| { | |
| method: 'POST', | |
| body: new URLSearchParams('myParam=myValue&myParam=anotherValue'), | |
| next: { | |
| revalidate: 30, | |
| }, | |
| } | |
| ).then((res) => res.text()) | |
| const dataWithBody4 = await fetchRetry( | |
| 'https://next-data-api-endpoint.vercel.app/api/random', | |
| { | |
| method: 'POST', | |
| body: new URLSearchParams('myParam=myValue&myParam=diffValue'), | |
| next: { | |
| revalidate: 30, | |
| }, | |
| } | |
| ).then((res) => res.text()) | |
| const dataWithBody5 = await fetchRetry( | |
| 'https://next-data-api-endpoint.vercel.app/api/random', | |
| { | |
| method: 'POST', | |
| body: new TextEncoder().encode(JSON.stringify({ hi: 'there' })), | |
| next: { | |
| revalidate: 30, | |
| }, | |
| } | |
| ).then((res) => res.text()) | |
| return ( | |
| <> | |
| <p id="page">/variable-revalidate/post-method-cached</p> | |
| <p id="page-data">{data}</p> | |
| <p id="data-body1">{dataWithBody1}</p> | |
| <p id="data-body2">{dataWithBody2}</p> | |
| <p id="data-body3">{dataWithBody3}</p> | |
| <p id="data-body4">{dataWithBody4}</p> | |
| <p id="data-body5">{dataWithBody5}</p> | |
| </> | |
| ) | |
| } | |
Xet Storage Details
- Size:
- 2.22 kB
- Xet hash:
- 63b1898fa99af3df0b2bab35e726159abf894a38d475e14d5cce19536ed8481b
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.