Skip to content

Restore original request body in FromRequest function + Bump to go1.18#33

Merged
Mzack9999 merged 5 commits intomainfrom
issue-32-restore-req-body
Dec 2, 2022
Merged

Restore original request body in FromRequest function + Bump to go1.18#33
Mzack9999 merged 5 commits intomainfrom
issue-32-restore-req-body

Conversation

@Mzack9999
Copy link
Copy Markdown
Member

Closes #32

@Mzack9999 Mzack9999 added the Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors. label Nov 30, 2022
@Mzack9999 Mzack9999 self-assigned this Nov 30, 2022
@Mzack9999 Mzack9999 changed the title Restore original request body in FromRequest function Restore original request body in FromRequest function + Bump to go1.18 Nov 30, 2022
@tarunKoyalwar
Copy link
Copy Markdown
Member

tarunKoyalwar commented Nov 30, 2022

  • General syntax update consequent to bump to 1.18
  • Check if the reader function can be simplified with ReusableReader

@tarunKoyalwar tarunKoyalwar self-assigned this Dec 1, 2022
@tarunKoyalwar
Copy link
Copy Markdown
Member

closes #30

Possible Explaination

Each unit test created a new web server (buggy http) on same port . but each of them ran on goroutines .
Instead of failing to bind to port . it could have caused race condition (at lower level). . Making all unit test use same server for testing fixed the issue

@tarunKoyalwar tarunKoyalwar marked this pull request as ready for review December 1, 2022 19:10
@tarunKoyalwar
Copy link
Copy Markdown
Member

Changes

  • Simplified logic (related to request body reuse)
  • Improvements and efficiency
  • Added more unit test to avoid similar situations in future

@tarunKoyalwar tarunKoyalwar linked an issue Dec 1, 2022 that may be closed by this pull request
@tarunKoyalwar
Copy link
Copy Markdown
Member

Verified with projectdiscovery/nuclei#2924 . Works as expected !!

@Mzack9999
Copy link
Copy Markdown
Member Author

Mzack9999 commented Dec 2, 2022

Excellent work - It seems much more uniform and efficient now, additionally the underlying http.Transport won't be locked into I/O waiting operations. Not related to this PR, but I'd also like to add these changes related to the lint-test.yml action:

  • Add checkout v3
  • Add actions/setup-go@v3 before calling golangci-lint-action (a few times, the analyzer got stuck due to missing go environment)

@Mzack9999
Copy link
Copy Markdown
Member Author

lgtm - merging

@Mzack9999 Mzack9999 merged commit c1a692a into main Dec 2, 2022
@Mzack9999 Mzack9999 deleted the issue-32-restore-req-body branch December 2, 2022 08:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FromRequest method should restore request body TestClient_Do - failing build test

2 participants