Skip to content

Instantly share code, notes, and snippets.

@kimh
Last active August 29, 2015 14:05
Show Gist options
  • Save kimh/a1002b5bf631c44041d1 to your computer and use it in GitHub Desktop.
Save kimh/a1002b5bf631c44041d1 to your computer and use it in GitHub Desktop.
Action#headers returns empty?
# Request: curl http://localhost:9292 -H "Content-type: application/json"
# Server log:
# [2014-08-23 22:28:17] INFO WEBrick 1.3.1
# [2014-08-23 22:28:17] INFO ruby 2.1.2 (2014-05-08) [x86_64-darwin13.0]
# [2014-08-23 22:28:17] INFO WEBrick::HTTPServer#start: pid=59002 port=9292
# testing #headers.empty?
# true
# 127.0.0.1 - - [23/Aug/2014 22:28:18] "GET HTTP/1.1" 200 - 0.0065
require 'lotus'
module OneFile
class Application < Lotus::Application
configure do
routes do
get '/', to: 'home#index'
end
end
load!
end
module Controllers
module Home
include Lotus::Controller
action 'Index' do
def call(params)
puts "testing #headers.empty?"
puts headers.empty?
end
end
end
end
module Views
module Home
class Index
include Lotus::View
def render
'Hello'
end
end
end
end
end
run OneFile::Application.new
PATH
remote: ~/git/lotus
specs:
lotusrb (0.1.0)
lotus-controller (~> 0.2)
lotus-router (~> 0.1, >= 0.1.1)
lotus-utils (~> 0.2)
lotus-view (~> 0.2)
thor (= 0.19.1)
GEM
remote: https://rubygems.org/
specs:
http_router (0.11.1)
rack (>= 1.0.0)
url_mount (~> 0.2.1)
lotus-controller (0.2.0)
lotus-utils (~> 0.2)
rack (~> 1.5)
lotus-router (0.1.1)
http_router (~> 0)
lotus-utils (~> 0)
lotus-utils (0.2.0)
lotus-view (0.2.0)
lotus-utils (~> 0.2)
tilt (~> 2.0, >= 2.0.1)
rack (1.5.2)
thor (0.19.1)
tilt (2.0.1)
url_mount (0.2.1)
rack
PLATFORMS
ruby
DEPENDENCIES
lotusrb!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment