Sha256: 337e64cac9b83d0d8c356ab6a072ec0aebe0f62c9e1cbb1a7ab277f4be48b0f7
Contents?: true
Size: 752 Bytes
Versions: 2
Compression:
Stored size: 752 Bytes
Contents
#!/usr/bin/env ruby $:<< '../lib' << 'lib' require 'goliath' require 'yajl' class AsyncUpload < Goliath::API use Goliath::Rack::Params # parse & merge query and body parameters use Goliath::Rack::DefaultMimeType # cleanup accepted media types use Goliath::Rack::Render, 'json' # auto-negotiate response format def on_headers(env, headers) env.logger.info 'received headers: ' + headers.inspect env['async-headers'] = headers end def on_body(env, data) env.logger.info 'received data: ' + data (env['async-body'] ||= '') << data end def on_close(env) env.logger.info 'closing connection' end def response(env) [200, {}, {body: env['async-body'], head: env['async-headers']}] end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
goliath-0.9.4 | examples/async_upload.rb |
goliath-0.9.2 | examples/async_upload.rb |