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

Seems to eat the body #1

Closed
skandragon opened this issue Apr 6, 2024 · 3 comments · Fixed by #2
Closed

Seems to eat the body #1

skandragon opened this issue Apr 6, 2024 · 3 comments · Fixed by #2
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@skandragon
Copy link
Collaborator

Adding this to the middleware on my Gin server seems to make the request body become empty, and return EOF on read.

@skandragon
Copy link
Collaborator Author

I believe the defect is the wrapper trying to restore the body.

	// Restore the request body for further processing
	c.Request.Body = io.NopCloser(bytes.NewReader(body))

This works, but the existing code which wraps the (now empty) c.Request.Body in the NopCloser fails to pass any content along.

@Cyprinus12138
Copy link
Owner

hi @skandragon Thank you for raising the issue; I will check this problem soon.

@Cyprinus12138 Cyprinus12138 linked a pull request Apr 6, 2024 that will close this issue
@Cyprinus12138 Cyprinus12138 added bug Something isn't working good first issue Good for newcomers labels Apr 6, 2024
Cyprinus12138 added a commit that referenced this issue Apr 6, 2024
* - Fix req body restoring
- Add unittests for calc the body size.

* - Update CHANGELOG.md
@Cyprinus12138
Copy link
Owner

hi @skandragon the bug should have be fixed in the version v1.0.1, thanks again for your contribution!
v1.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants