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

Fix case of nil/http.NoBody request.Body on interceptor tripperware/middleware #45

Merged
merged 2 commits into from
Jan 18, 2024
Merged

Conversation

tle-dieu
Copy link
Contributor

No description provided.

Copy link

codeclimate bot commented Jan 18, 2024

Code Climate has analyzed commit ea5a4ae and detected 0 issues on this pull request.

View more on Code Climate.

@instabledesign
Copy link
Member

Looks good to me, thank you

@instabledesign instabledesign merged commit 1fa12b4 into gol4ng:master Jan 18, 2024
1 check passed
@@ -42,7 +43,12 @@ type copyReadCloser struct {
// Second read after EOF
// copyBuffered --> copy BufReader simple buffer with fix size
// when BufReader is EOF offset is reset to read again
func NewCopyReadCloser(src io.ReadCloser) *copyReadCloser {
func NewCopyReadCloser(src io.ReadCloser) io.ReadCloser {
Copy link
Member

Choose a reason for hiding this comment

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

For the reviewers :

  • We now return an io.ReadCloser interface instead of a concrete copyReadCloser.
  • When the request body is nil, the Interceptor middleware/tripperware segfaults as it tries to read a nil body without checking it.

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.

3 participants