title: Reading PUT data from piped cURL in Sinatra
body: <p>I'm rewriting a small server backend in Sinatra, and currently the client talks to it via cURL calls such as <code>echo "foo" | curl -X PUT -T - http://localhost:8090/</code>. The problem is, in my <code>put</code> method in Sinatra, the <code>request.body.read</code> is always empty, even after I call <code>rewind</code> on it. Furthermore, the <code>params</code> hash is completely empty.</p>
  
  <p>What's weird is that if I do <code>curl -X PUT -d 'foo' http://localhost:8090/</code> instead it works. Also, in node.js I can read it fine using the <code>request.on('data')</code> and <code>request.on('end')</code> functions.</p>
  
  <p>Is there any way to read the <code>PUT</code> body in Sinatra? I would like to avoid changing the client code if at all possible.</p>