go-resty / resty

Simple HTTP and REST client library for Go
MIT License
9.68k stars 681 forks source link

Add Client.Clone function #774

Closed fabiante closed 4 months ago

fabiante commented 5 months ago

This adds a crude cloning function. It can be used to have a main client with default values and then create copies from that, which must use custom values.

The added function is rather crude and may introduce the potential that, when adding a new Client field, we forget to add it to Clone.

Thus, we should discuss if this is the right way to go. Using code generation or relflection might be a more maintainable solution.

Merging this PR would close #773

codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 96.48%. Comparing base (0ac42a2) to head (2c5a4a7).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## v2 #774 +/- ## ========================================== + Coverage 96.46% 96.48% +0.01% ========================================== Files 12 12 Lines 1643 1650 +7 ========================================== + Hits 1585 1592 +7 Misses 37 37 Partials 21 21 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.