Sha256: 0f5d72bd68ecb98d103c06b9d245eda9a169abe7a141e685d90107055a9fd6cf

Contents?: true

Size: 452 Bytes

Versions: 72

Compression:

Stored size: 452 Bytes

Contents

require 'rack'
require 'pry'

class Echo
	def initialize(app)
		@app = app
	end
	
	def call(env)
		request = Rack::Request.new(env)
		
		if request.path_info == "/echo"
			if output = request.body
				return [200, {}, output.body]
			else
				return [200, {}, ["Hello World?"]]
			end
		else
			return @app.call(env)
		end
	end
end

use Echo

use Rack::Static, :urls => [''], :root => 'public', :index => 'index.html'

run lambda{|env| [404, {}, []]}

Version data entries

72 entries across 72 versions & 1 rubygems

Version Path
async-http-0.50.8 examples/fetch/config.ru
async-http-0.50.7 examples/fetch/config.ru
async-http-0.50.6 examples/fetch/config.ru
async-http-0.50.5 examples/fetch/config.ru
async-http-0.50.4 examples/fetch/config.ru
async-http-0.50.3 examples/fetch/config.ru
async-http-0.50.2 examples/fetch/config.ru
async-http-0.50.1 examples/fetch/config.ru
async-http-0.50.0 examples/fetch/config.ru
async-http-0.49.1 examples/fetch/config.ru
async-http-0.49.0 examples/fetch/config.ru
async-http-0.48.2 examples/fetch/config.ru
async-http-0.48.1 examples/fetch/config.ru
async-http-0.48.0 examples/fetch/config.ru
async-http-0.47.0 examples/fetch/config.ru
async-http-0.46.5 examples/fetch/config.ru
async-http-0.46.4 examples/fetch/config.ru
async-http-0.46.3 examples/fetch/config.ru
async-http-0.46.2 examples/fetch/config.ru
async-http-0.46.1 examples/fetch/config.ru