Need to call rewind on the request stream to make it works with rails 4
merge from huyh/master