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

improve body copy logic #655

Conversation

zhongdalu-trechina
Copy link
Contributor

improve #635

@codecov
Copy link

codecov bot commented May 6, 2023

Codecov Report

Patch coverage: 50.00% and project coverage change: -0.75% ⚠️

Comparison is base (b852413) 96.34% compared to head (d783b5f) 95.60%.

❗ Current head d783b5f differs from pull request most recent head dabc3ee. Consider uploading reports for the commit dabc3ee to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #655      +/-   ##
==========================================
- Coverage   96.34%   95.60%   -0.75%     
==========================================
  Files          12       11       -1     
  Lines        1615     1569      -46     
==========================================
- Hits         1556     1500      -56     
- Misses         37       42       +5     
- Partials       22       27       +5     
Files Changed Coverage Δ
middleware.go 89.89% <50.00%> (-3.09%) ⬇️

... and 4 files with indirect coverage changes

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

@zhongdalu-trechina zhongdalu-trechina marked this pull request as draft May 6, 2023 05:33
@jeevatkm
Copy link
Member

jeevatkm commented Sep 17, 2023

@zhongdalu-trechina Did you get a chance to test your changes?

@zhongdalu-trechina zhongdalu-trechina marked this pull request as ready for review September 25, 2023 08:40
@zhongdalu-trechina
Copy link
Contributor Author

@zhongdalu-trechina Did you get a chance to test your changes?

yeah, just did some basic testing locally.

bodyBuf := bytes.NewBuffer(append([]byte{}, r.bodyBuf.Bytes()...))
r.RawRequest, err = http.NewRequest(r.Method, r.URL, bodyBuf)
// deep copy
bodyCopy := acquireBuffer()
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see where you release the acquired buffer

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should be so, but I think there is no place to release it, do you have any ideas?

@jeevatkm
Copy link
Member

@zhongdalu-trechina Thanks for your PR. I'm unclear about the improvements this PR brings to body copy handling; I may need time to understand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants