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

chore: extract methods #1740

Merged
merged 1 commit into from
Jun 26, 2024
Merged

Conversation

TimothyMakkison
Copy link
Contributor

@TimothyMakkison TimothyMakkison commented Jun 26, 2024

Extracted methods into:

  • AddBodyToRequest
  • AddQueryParameters
  • AddMultiPart
  • AddHeadersToRequest
  • AddPropertiesToRequest

I haven't changed any logic, this commit is to make it easier to understand the scope of logic and to cut down on the massive function. I plan on removing the following collections in a subsequent pr 🤞

var queryParamsToAdd = new List<KeyValuePair<string, string?>>(); // either use `ValueStringBuilder` or `ValueListBuilder`
var headersToAdd = new Dictionary<string, string?>(restMethod.Headers); `ValueListBuilder` or add directly with a check
var propertiesToAdd = new Dictionary<string, object?>(); // iterate params later on and directly add to `HttpRequest` both property/option are internally dictionaries.

Copy link

codecov bot commented Jun 26, 2024

Codecov Report

Attention: Patch coverage is 93.10345% with 8 lines in your changes missing coverage. Please review.

Project coverage is 83.90%. Comparing base (6ebeda5) to head (6f388dd).
Report is 49 commits behind head on main.

Files Patch % Lines
Refit/RequestBuilderImplementation.cs 93.10% 6 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1740      +/-   ##
==========================================
- Coverage   87.73%   83.90%   -3.84%     
==========================================
  Files          33       36       +3     
  Lines        2348     2441      +93     
  Branches      294      328      +34     
==========================================
- Hits         2060     2048      -12     
- Misses        208      309     +101     
- Partials       80       84       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ChrisPulman
Copy link
Member

@TimothyMakkison next conflict 😊

@TimothyMakkison
Copy link
Contributor Author

TimothyMakkison commented Jun 26, 2024

@TimothyMakkison next conflict 😊

Should be done 🤞

I've been looking at removing the header dictionary and realised that I have to support .Net framework 😄 I'm currently planning on creating an inlinearray and converting it into a ValueListBuilder<KeyValuePair<string, string?>> for headers. The only way this is possible in .Net framework would be the use of unsafe code.

Would this be a deal breaker? Otherwise I can use some preprocessors and treat ,NEt Framework as a special case.

@ChrisPulman
Copy link
Member

Let's keep the Netframework as a special case, there's a lot of companies that won't move forward until the last second and adopt new technologies. So long as the functionality of all TFM's are equal with regards to the output then we can even keep a separated section for Netframework, but it's a no from me for unsafe calls.
I am happy to provide a highly performant Netstandard2.0 / net6.0+ Version and if possible include Net462 otherwise create patches to keep the API and output standard.

@ChrisPulman ChrisPulman merged commit 44314ba into reactiveui:main Jun 26, 2024
2 of 3 checks passed
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 Jul 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants