new Response(csv, { headers })A content-disposition header makes the browser save it as a file.
Besides JSX, strings, buffers and JSON, a route can return a standard Response object: status, headers and body are taken from it.
This makes it easy to reuse code written for other web-standard runtimes or to proxy a fetch call straight through. Click a card to see each response.
new Response(csv, { headers })A content-disposition header makes the browser save it as a file.
Response.json(data)Sets body and content type in one go.
new Response(null, {
status: 303, headers
})Sends the browser straight back to this page.
new Response(body, {
status: 418
})Any status code works, even the teapot.
fetch(url)Passes a remote response through, cached for five minutes.