Class: Livestatus::API

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/livestatus/api.rb

Instance Method Summary collapse

Instance Method Details

#parse_headers(env) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/livestatus/api.rb', line 8

def parse_headers(env)
  Hash[env.select do |k, v|
    k =~ /^HTTP_X_LIVESTATUS_/
  end.map do |k, v|
    v = Yajl::Parser.parse(v) if v =~ /^\[/
    [k[18..-1].downcase.to_sym, v]
  end]
end