Module: Lipa::Web::Response::JSON

Defined in:
lib/lipa/web/response/json.rb

Class Method Summary collapse

Class Method Details

.response(node) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/lipa/web/response/json.rb', line 31

def self.response(node)
  body = if node.json
           j = {}
           node.json[:block].call(j)
           j.to_json
         else
           render_default_json(node) 
         end

  [ 200, { "Content-Type" => "application/json" }, [body]]
end