feat(transport/http): remove wrapper.w and add Unwrap method for acce…
Description (what this PR does / why we need it):
- Remove wrapper.w to avoid confused of ResponseWriter.
- Add unwrap method for accessing wrapped ResponseWriter.
- Create testing code for wrapper.Result.
Now users can use followed code to get custom ResponseWriter they passed:
if u, ok := w.(interface { Unwrap() http.ResponseWriter }); ok {
if cw, ok := w.Unwrap().(*CustomResponseWriter); ok {
// do something with CustomResponseWriter
}
}
Which issue(s) this PR fixes (resolves / be part of):
fixes/resolves #3174
Other special notes for the reviewers:
Rename "responseWriter" to "wrappedWriter" for better semantics.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
c7fa51d) 84.62% compared to head (33531fb) 84.60%.
:exclamation: Current head 33531fb differs from pull request most recent head 582e3ee. Consider uploading reports for the commit 582e3ee to get more accurate results
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@ Coverage Diff @@
## main #3189 +/- ##
==========================================
- Coverage 84.62% 84.60% -0.02%
==========================================
Files 88 88
Lines 3993 3988 -5
==========================================
- Hits 3379 3374 -5
Misses 440 440
Partials 174 174
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.