Method: Curl::Easy#headers=

Defined in:
ext/curb_easy.c

#headers=(headers) ⇒ Object

easy.headers = => “val” …, “Header” => “val” => val”, …

easy.headers = ["Header: val" ..., "Header: val"]         => ["Header: val", ...]

Set custom HTTP headers for following requests. This can be used to add custom headers, or override standard headers used by libcurl. It defaults to a Hash.

For example to set a standard or custom header:

easy.headers["MyHeader"] = "myval"

To remove a standard header (this is useful when removing libcurls default ‘Expect: 100-Continue’ header when using HTTP form posts):

easy.headers["Expect"] = ''

Anything passed to libcurl as a header will be converted to a string during the perform step.



637
638
639
# File 'ext/curb_easy.c', line 637

static VALUE ruby_curl_easy_headers_set(VALUE self, VALUE headers) {
  CURB_OBJECT_HSETTER(ruby_curl_easy, headers);
}