Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in readme.txt that shows after installing package #886

Closed
Misiu opened this issue Oct 6, 2016 · 6 comments
Closed

Bug in readme.txt that shows after installing package #886

Misiu opened this issue Oct 6, 2016 · 6 comments

Comments

@Misiu
Copy link

Misiu commented Oct 6, 2016

Inside readme.txt that is shown when we install ReshSharp package we see how to enable Newtonsoft.JSON serializer:

var client = new RestClient();
client.JsonSerializer = new YourCustomSerializer();

but RestClient doesn't have JsonSerializer property.
This should be changed to:

var request = new RestRequest();
request.JsonSerializer =  new YourCustomSerializer();

Also this allows us to specify serializer for each request. Is there an option to specify default serializer for RestClient?
Ideally this should be a property of RestClient as shown in readme.txt, so instead fixing readme.txt just add that property to RestClient.

@behoyh
Copy link

behoyh commented Oct 6, 2016

There is a pull request for this, let me check on that.

@Misiu
Copy link
Author

Misiu commented Oct 6, 2016

@behoyh I've checked that, it looks like it is accepted. But what about setting default serializer for RestClient? Is it possible to add?

@behoyh
Copy link

behoyh commented Oct 6, 2016

The default is JsonDeserializer - after you call client.Execute(request); You can't change this default.

@Misiu
Copy link
Author

Misiu commented Oct 7, 2016

@behoyh what I mean was that in readme.txt is bug (already fixed by PR You mentioned).
In my project I'm using Newtonsoft JSON serializer and right now I must set serializer each time I make request (request.JsonSerializer = new YourCustomSerializer();)
Ideally I'd like to have option to set globally JsonSerializer that RestSharp will use, in my case I'd like to set Newtonsoft as default and not use build-in.
I'd like to set that in one place as default.

@Misiu
Copy link
Author

Misiu commented Oct 15, 2016

@behoyh there is one thing missing - deserializer in custom serialize class You guys mention in readme.txt.

Also It would be great is we can set serializer and deserializer for client, so all request would use them.

@alexeyzimarev
Copy link
Member

The readme is fixed and we will also change how serialisers are customised, it will be in the documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants