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

Use System.Text.Json by default #1005

Merged
merged 4 commits into from
Nov 25, 2020
Merged

Use System.Text.Json by default #1005

merged 4 commits into from
Nov 25, 2020

Conversation

clairernovotny
Copy link
Member

Implements and fixes #981

Refit now uses System.Text.Json by default and provides a new package containing support for Newtonsoft.Json.

Todo: Update docs.

@anaisbetts @bennor

@@ -1058,7 +1062,7 @@ public void MethodsShouldBeCancellableDefault()
{
var fixture = new RequestBuilderImplementation<ICancellableMethods>();
var factory = fixture.RunRequest("GetWithCancellation");
var output = factory(new object[0]);
var output = factory(Array.Empty<object>());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not know this exists, but it looks like it's not even new. I assume it's cheaper than creating an empty array every time?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, removes allocations

@@ -20,7 +20,7 @@ public CachedRequestBuilderImplementation(IRequestBuilder innerBuilder)
}

readonly IRequestBuilder innerBuilder;
readonly ConcurrentDictionary<string, Func<HttpClient, object[], object>> methodDictionary = new ConcurrentDictionary<string, Func<HttpClient, object[], object>>();
readonly ConcurrentDictionary<string, Func<HttpClient, object[], object>> methodDictionary = new();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😻

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Split out serialization format from main library
2 participants