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

Remove TeeWriter #28

Merged
merged 3 commits into from
Feb 14, 2024
Merged

Remove TeeWriter #28

merged 3 commits into from
Feb 14, 2024

Conversation

tigerwill90
Copy link
Owner

@tigerwill90 tigerwill90 commented Feb 14, 2024

Description

This PR removes the TeeWriter method from the Context interface. The decision to remove this method is based on the assessment that it does not add significant value to the current implementation. The functionality provided TeeWriter can be effectively replaced and extended by middleware solutions. Specifically, the foxdump middleware is planned to implement similar functionality, offering a more modular and flexible approach to capturing and duplicating response bodies for logging, debugging, or any other purposes that require access to the response body data stream.

Removed Method Detail

The TeeWriter method was designed to append an additional writer (sink) to which the response body would be simultaneously written, alongside the primary ResponseWriter. This method aimed to facilitate scenarios where capturing the response body for logging or analysis was necessary without disrupting the standard response flow to the client.

Performance

goos: linux
goarch: amd64
pkg: github.com/tigerwill90/fox
cpu: Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
                    │   old.txt    │               new.txt               │
                    │    sec/op    │    sec/op     vs base               │
StaticAll-16          11.16µ ±  1%   11.26µ ±  1%  +0.88% (p=0.003 n=10)
GithubParamsAll-16    83.33n ±  1%   82.90n ±  2%       ~ (p=0.165 n=10)
OverlappingRoute-16   98.27n ±  0%   94.97n ±  1%  -3.35% (p=0.000 n=10)
StaticParallel-16     10.29n ±  1%   10.29n ±  4%       ~ (p=0.926 n=10)
CatchAll-16           31.38n ±  1%   31.71n ±  1%  +1.04% (p=0.050 n=10)
CatchAllParallel-16   5.918n ± 12%   5.806n ± 22%       ~ (p=0.280 n=10)
CloneWith-16          70.51n ±  1%   69.78n ±  2%  -1.03% (p=0.028 n=10)
geomean               74.15n         73.62n        -0.71%

@tigerwill90 tigerwill90 requested a review from pawndev February 14, 2024 08:46
@tigerwill90 tigerwill90 self-assigned this Feb 14, 2024
Copy link

codecov bot commented Feb 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (4858ca2) 84.32% compared to head (011ea2b) 87.02%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #28      +/-   ##
==========================================
+ Coverage   84.32%   87.02%   +2.69%     
==========================================
  Files          12       12              
  Lines        1831     1657     -174     
==========================================
- Hits         1544     1442     -102     
+ Misses        252      185      -67     
+ Partials       35       30       -5     
Flag Coverage Δ
coverage.txt 87.02% <ø> (+2.69%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@tigerwill90 tigerwill90 marked this pull request as draft February 14, 2024 10:06
@tigerwill90 tigerwill90 marked this pull request as ready for review February 14, 2024 12:18
@tigerwill90 tigerwill90 merged commit 6b8d3ab into master Feb 14, 2024
8 checks passed
@tigerwill90 tigerwill90 deleted the feat/remove-teewriter branch February 14, 2024 14:25
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

Successfully merging this pull request may close these issues.

1 participant