Module: Grape::DSL::Headers
- Included in:
- InsideRoute, Middleware::Base
- Defined in:
- lib/grape/dsl/headers.rb
Instance Method Summary collapse
-
#header(key = nil, val = nil) ⇒ Object
(also: #headers)
This method has four responsibilities: 1.
Instance Method Details
#header(key = nil, val = nil) ⇒ Object Also known as: headers
This method has four responsibilities:
-
Set a specifc header value by key
-
Retrieve a specifc header value by key
-
Retrieve all headers that have been set
-
Delete a specifc header key-value pair
11 12 13 14 15 16 17 |
# File 'lib/grape/dsl/headers.rb', line 11 def header(key = nil, val = nil) if key val ? header[key.to_s] = val : header.delete(key.to_s) else @header ||= Grape::Util::Header.new end end |