All,
I'm playing around with the async_upload example and I've hit a strange snag - running it standalone works fine, but in conjunction with a router it doesn't work.
Assuming this directory structure:
test_async
├── Gemfile
├── Gemfile.lock
├── apis
└── async_upload.rb
└── test.rb
If I cd into apis and run `ruby async_upload.rb`, and the following request, all is well.
$ curl -X PUT -H 'Content-Type: image/jpeg'
http://localhost:8910 --data-binary "this is some awesome data"
[:body, "this is some awesome data"][:head, {"User-Agent"=>"curl/7.21.6 (x86_64-apple-darwin10.8.0) libcurl/7.21.6 OpenSSL/0.9.8r zlib/1.2.3", "Host"=>"localhost:8910", "Accept"=>"*/*", "Content-Type"=>"image/jpeg", "Content- Length"=>"38"}]%
If I cd into the root dir and ruby `ruby test.rb`, none of the callbacks (on_body, on_headers or on_close) get called.
$ /usr/local/Cellar/curl/7.21.6/bin/curl -X PUT -H 'Content-Type: image/jpeg'
http://localhost:8910/async --data-binary "this is some awesome data for that ass"
[:body, nil][:head, nil]%
test.rb looks like this:
require 'goliath'
api_dir = File.dirname(__FILE__) + '/apis'
$LOAD_PATH.unshift(api_dir)
require 'async_upload'
class Test < Goliath::API
put '/async' do
run AsyncUpload.new
end
end
Thanks!
--
Mando