Request body as ReadableStream

by Jonas Jasas

JavaScript

fetch('https://httpbin.org/get')
	.then(resp => {
		let req =  new Request('https://example.com', {
    	method: 'POST',
      body: resp.body
    })
    resp.body.pipeTo(req.body)
    return req
  })
  .then(req => req.text())
  .then(alert)