Sha256: 8e5395ead46c2f470790f92e4b10ad37b479697901d5eede551c24c8c8065aef

Contents?: true

Size: 587 Bytes

Versions: 9

Compression:

Stored size: 587 Bytes

Contents

#!/usr/bin/env falcon --verbose serve --concurrency 1 --config
# frozen_string_literal: true

class EarlyHints
	def initialize(app)
		@app = app
	end
	
	def call(env)
		path = env['PATH_INFO']
		early_hints = early_hints = env['rack.early_hints']
		
		Async.logger.debug("path: #{path} #{early_hints}")
		
		if path == "/index.html" and early_hints
			early_hints.push("/style.css")
			early_hints.push("/script.js")
		end
		
		@app.call(env)
	end
end

use EarlyHints

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

run lambda{|env| [404, [], ["Not Found"]]}

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
falcon-0.36.4 examples/push/config.ru
falcon-0.36.3 examples/push/config.ru
falcon-0.36.2 examples/push/config.ru
falcon-0.36.1 examples/push/config.ru
falcon-0.36.0 examples/push/config.ru
falcon-0.35.6 examples/push/config.ru
falcon-0.35.5 examples/push/config.ru
falcon-0.35.4 examples/push/config.ru
falcon-0.35.3 examples/push/config.ru