Module: HttpBaseline::Methods

Defined in:
lib/http_baseline/methods.rb

Instance Method Summary collapse

Instance Method Details

#set_headers_by(c_type) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/http_baseline/methods.rb', line 4

def set_headers_by(c_type)
  type = case c_type
           when /json/i
             'application/json'
           when /form/i
             'application/x-www-form-urlencoded'
           else
             c_type
         end
  connection.add_header 'Content-Type', type unless c_type.nil? || c_type.empty?
end