replicate / replicate-go

Go client for Replicate
https://replicate.com
Apache License 2.0
65 stars 9 forks source link

Reset HTTP request body after reading the stream during webhook validation #64

Closed shonun1 closed 3 months ago

shonun1 commented 3 months ago

Hi!

I couldn't find any contribution guidelines in the repository, so I've done my best to follow the existing conventions. If there are any issues with this contribution, please let me know.

To give a bit of context on the change: I started using the ValidateWebhookRequest function in the API I was developing. However, I encountered an issue where the HTTP request body was left empty after validation and I needed it for further processing. While I implemented a workaround on my end, I believe the proper solution is to reset the buffer inside the validation function to avoid interfering with any of the input data. More people might encounter this issue when the library is more widely used, so I thought I would attempt to make this change directly in the library. I look forward to your feedback!

mattt commented 3 months ago

Thanks so much for your contribution, @shonun1. I think you're spot on with this change. Once CI passes, I'll merge this in and cut a new release.

mattt commented 3 months ago

This is now available in v0.18.2. Thanks again for your help, @shonun1 🙌

shonun1 commented 3 months ago

Thank you for the quick response and release!