You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
NullReferenceException in ExecutePost when Header value is null #2227
Describe the bug
When adding a header with a null value, an exception is thrown when sending the request and requires looking at the call stack to infer the cause of the exception.
I think this could be made clearer by throwing the exception when adding the header, or returning a more detailed message in the later thrown exception.
To Reproduce
var client = new RestClient("baseUrl");
var request = new RestRequest("endpoint");
request.AddJsonBody(model);
request.AddHeader("X-SomeHeader", null);
var response = client.ExecutePost(request);
Expected behavior
Either an exception is thrown on the AddHeader() call, or a more detailed exception message is returned when calling ExecutePost()
Activity