Sha256: 6399ca00eef566480bc3b4a91a18aa372fe07b7f81be2f3d6c559fb9cff96c52

Contents?: true

Size: 613 Bytes

Versions: 4

Compression:

Stored size: 613 Bytes

Contents

require 'sinatra'
require 'yajl/json_gem'
require 'pp'

set(:mongrel2_upload) do |value|
  condition do
    case value
    when :start
      request.env.key?('HTTP_X_MONGREL2_UPLOAD_START')
    when :done
      request.env.key?('HTTP_X_MONGREL2_UPLOAD_DONE')
    else
      false
    end
  end
end

before do
  pp request
end

put '/ok', :mongrel2_upload => :done do
  'upload done'
end

put '/ok', :mongrel2_upload => :start do
  throw :async # continue the upload
end

put '/ng', :mongrel2_upload => :done do
  'this will never happen'
end

put '/ng', :mongrel2_upload => :start do
  '' # cancel the upload
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
em-rack-mongrel2-0.2.3 example/upload/app.rb
em-rack-mongrel2-0.2.2 example/upload/app.rb
em-rack-mongrel2-0.2.1 example/upload/app.rb
em-rack-mongrel2-0.2.0 example/upload/app.rb