function createAwsResponseStream() {
  let responseDoneResolve
  let responseDoneReject
  const responseDonePromise = new Promise((resolve, reject) => {
    responseDoneResolve = resolve
    responseDoneReject = reject
  })

  let result = ''
  const stream = new Writable({
    write(chunk, encoding, callback) {
      result += chunk
      callback()
    }
  })

  stream.setContentType = function () {}

  stream.on('error', (error) => {
    if (responseDoneReject) responseDoneReject(error)
  })

  stream.on('close', () => {
    responseDoneResolve(result)
  })

  return {
    request: stream,
    headersDone: Promise.resolve(),
    responseDone: responseDonePromise
  }
}
Creates a writable stream that simulates the stream actions AWS's Lambda
runtime expects when working with streamable handlers.

@returns {Writable} Stream