Module: SimpleHelper::HeadersProcessor

Defined in:
lib/simple_helper/headers_processor.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#headersObject (readonly)

Returns the value of attribute headers.



5
6
7
# File 'lib/simple_helper/headers_processor.rb', line 5

def headers
  @headers
end

Class Method Details

.perform(headers) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/simple_helper/headers_processor.rb', line 7

def self.perform(headers)
  return {} if headers.nil? || !headers.respond_to?(:to_hash)

  @headers = headers.stringify_keys!

  return @headers unless @headers['Content-Type'].nil?

  { 'Content-Type' => 'application/json' }.merge(@headers)
end