Sha256: 8f3feabb22b3858114b3264561766ac68ddb0e036e69f26b7b292c239fe35a6d

Contents?: true

Size: 1.22 KB

Versions: 71

Compression:

Stored size: 1.22 KB

Contents

$stderr.puts "loading"
require 'sinatra'

configure do
  set :foo, :bar
end

get '/app_file' do
  content_type :txt
  settings.app_file
end

get '/ping' do
  'pong'
end

get '/stream' do
  stream do |out|
    sleep 0.1
    out << "a"
    sleep 1.2
    out << "b"
  end
end

get '/mainonly' do
  object = Object.new
  begin
    object.send(:get, '/foo') { }
    'false'
  rescue NameError
    'true'
  end
end

set :out, nil
get '/async' do
  stream(:keep_open) { |o| (settings.out = o) << "hi!" }
end

get '/send' do
  settings.out << params[:msg] if params[:msg]
  settings.out.close if params[:close]
  "ok"
end

get '/send_file' do
  file = File.expand_path '../../views/a/in_a.str', __FILE__
  send_file file
end

get '/streaming' do
  headers['Content-Length'] = '46'
  stream do |out|
    out << "It's gonna be legen -\n"
    sleep 0.5
    out << " (wait for it) \n"
    puts headers
    sleep 1
    out << "- dary!\n"
  end
end

class Subclass < Sinatra::Base
  set :out, nil
  get '/subclass/async' do
    stream(:keep_open) { |o| (settings.out = o) << "hi!" }
  end

  get '/subclass/send' do
    settings.out << params[:msg] if params[:msg]
    settings.out.close if params[:close]
    "ok"
  end
end

use Subclass

$stderr.puts "starting"

Version data entries

71 entries across 68 versions & 20 rubygems

Version Path
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/sinatra-1.4.8/test/integration/app.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/sinatra-1.4.8/test/integration/app.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/sinatra-1.4.8/test/integration/app.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/sinatra-1.4.8/test/integration/app.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/sinatra-1.4.8/test/integration/app.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/sinatra-1.4.8/test/integration/app.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/sinatra-1.4.8/test/integration/app.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/sinatra-1.4.8/test/integration/app.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/sinatra-1.4.8/test/integration/app.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/sinatra-1.4.8/test/integration/app.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/sinatra-1.4.8/test/integration/app.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/sinatra-1.4.8/test/integration/app.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/sinatra-1.4.8/test/integration/app.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/sinatra-1.4.8/test/integration/app.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/sinatra-1.4.8/test/integration/app.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/sinatra-1.4.8/test/integration/app.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/sinatra-1.4.8/test/integration/app.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/sinatra-1.4.8/test/integration/app.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/sinatra-1.4.8/test/integration/app.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/sinatra-1.4.8/test/integration/app.rb