Method: HTTP::Headers#set

Defined in:
lib/http/headers.rb

#set(name, value) ⇒ void Also known as: []=

This method returns an undefined value.

Sets header.

Parameters:

  • name (String, Symbol)

    header name. When specified as a string, the name is sent as-is. When specified as a symbol, the name is converted to a string of capitalized words separated by a dash. Word boundaries are determined by an underscore (_) or a dash (-). Ex: :content_type is sent as "Content-Type", and "auth_key" (string) is sent as "auth_key".

  • value (Array<#to_s>, #to_s)

    header value(s) to be appended



56
57
58
59
# File 'lib/http/headers.rb', line 56

def set(name, value)
  delete(name)
  add(name, value)
end