restsharp/RestSharp — pull request #515 by StevenLiekens (2014-03-09 18:12:58+00:00)
Title: Fixing an uncaught ArgumentNullException that is thrown when 'RestClient.EncodeParameters()' tries to 'UrlEncode()' null values

Currently, it is possible to do this:

```C#
restRequest.AddParameter("name", null);
```

However, when `restClient.Execute(restRequest)` is called and the code reaches the `StringExtensions.UrlEncode()` extension, an `ArgumentNullException` is thrown because parameter value is `null`. This makes absolutely no logical sense, and is bound to confuse the end-user (including yours truly).

This patch works around this problem by encoding only the parameter name and simply ignoring the `null` value.

```C#
restClient.AddParameter("first", "value");
restClient.AddParameter("second", null);
restClient.AddParameter("third", null);
restClient.AddParameter("last", "least");

// output query string: first=value&second=&third=&last=least
```