NullReferenceException with AddBody method #23
Comments
I created a small unit test, but I cannot reproduce the error. Maybe you can provide a small test case? |
ok, i create simple app - one button, one method, problem reproduce on my computer:
Request object
Service wrapper
button handler - initiate request
test solution - https://dl.dropboxusercontent.com/u/75125692/WPTest.7z |
I just took a look at the sample application, and the only place where I get a |
hm, thats strange, becouse i have exception on await.. ok i'll test on another pc |
Closed, because the problem is not reproducible. |
I have the same problem. When my API return string all is ok, but if I want to obtain object from json, still get this error. |
Can you provide a test case and a stack trace, because I'm unable to reproduce the error. |
Closed, because I cannot reproduce this problem. |
It may be caused by this line. So it happens if you have a HttpBasicAuthenticator on the client. A workaround is to call client.Authenticator.Authenticate before AddBody, since there at that point will be no parameters without a name (which is what causes the NullReferenceException). You should be able to reproduce it with this: var client = new RestClient("http://www.google.com");
client.Authenticator = new HttpBasicAuthenticator("foo", "bar");
var request = new RestRequest("Foo").AddBody("foo");
await client.Execute(request); It will fail on the Execute. |
Thank you, I'll update it soon, |
good day!
i try to use your library but have confused when need send json request to server:
other method (without request body) work fine
then i try to set up body with AddParameter:
and this work perfectly
The text was updated successfully, but these errors were encountered: