Question: In Code I am trying to send both the header and cookies in same request 
below is the code

```
 @result = RestClient.post(
              'url',
              {:billingSourceCode => "code"},
              {:cookies => {:session_id => "1234"}},
              {:headers => {'Content-Type' =>'application/json', 
                           "Authorization" => "key",  
                           "Accept" => "application/json"}})

```

i am getting below error message

```
ArgumentError (wrong number of arguments (4 for 3)):

```

Answer: 
Cookies are part of headers. Here in `RestClient` : 

```
    @cookies = @headers.delete(:cookies) || args[:cookies] || {}

```

See in `initialize` method in <https://github.com/rest-client/rest-client/blob/master/lib/restclient/request.rb>

Do this -

```
@result = RestClient.post(
          'url',
          {:billingSourceCode => "code"},
          {:headers => {'Content-Type' =>'application/json', 
                       "Authorization" => "key",  
                       "Accept" => "application/json"},
                       {:cookies => {:session_id => "1234"}}
          })

```
Try 

```
RestClient::Request.execute(
      method: :post,
      url: 'whatever',
      cookies: {:session_id => "1234"},
      headers: {'Content-Type' =>'application/json',
                      "Authorization" => "key",
                      "Accept" => "application/json"})

```