Module: Grape::DSL::Headers

Included in:
InsideRoute, Middleware::Base
Defined in:
lib/grape/dsl/headers.rb

Instance Method Summary collapse

Instance Method Details

#header(key = nil, val = nil) ⇒ Object Also known as: headers

Set an individual header or retrieve all headers that have been set.


6
7
8
9
10
11
12
# File 'lib/grape/dsl/headers.rb', line 6

def header(key = nil, val = nil)
  if key
    val ? header[key.to_s] = val : header.delete(key.to_s)
  else
    @header ||= {}
  end
end