Module: Crystal::HTTPAdapter
- Defined in:
- lib/crystal/http/http_adapter.rb
Class Method Summary collapse
- .call(env, workspace = {}, &block) ⇒ Object
-
.mock_call(env = {}, workspace = {}, &block) ⇒ Object
synchronize_method :call.
Class Method Details
.call(env, workspace = {}, &block) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/crystal/http/http_adapter.rb', line 7 def call env, workspace = {}, &block # result, opt = nil, opt.to_openobject workspace = conveyors.web.call( {:env => env, :response => Crystal::Response.new}.merge(workspace.symbolize_keys), &block ) workspace.response.must_be.defined workspace.response.content_type ||= Mime.send(config.default_format) result = workspace.response.to_a result end |
.mock_call(env = {}, workspace = {}, &block) ⇒ Object
synchronize_method :call
22 23 24 25 26 27 |
# File 'lib/crystal/http/http_adapter.rb', line 22 def mock_call env = {}, workspace = {}, &block env['PATH_INFO'] ||= '/' env['rack.input'] ||= StringIO.new call env, workspace, &block end |