rsnext/test/integration/api-support/pages/api/test-res-pipe.js
JJ Kasper 65de050017
Update to not show API not ended warning when response is piped to (#10342)
* Update to not show API not ended warning when response is piped to

* Update to use res.once

Co-authored-by: Joe Haddad <timer150@gmail.com>
2020-02-02 21:48:00 -06:00

10 lines
228 B
JavaScript

import fetch from 'node-fetch'
export default async (req, res) => {
const dataRes = await fetch(
`http://localhost:${req.query.port}/api/query?hello=from-pipe`
)
res.status(dataRes.status)
dataRes.body.pipe(res)
}