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

Set Request.GetBody in doRequest #58

Merged
merged 2 commits into from
Jun 12, 2024
Merged

Conversation

vincent-stytch
Copy link

@vincent-stytch vincent-stytch commented Jun 12, 2024

I was running into an issue periodically:

Post "https://api.postmarkapp.com/email": http2: Transport: cannot retry err [http2: Transport received Server's graceful shutdown GOAWAY] after Request.Body was written; define Request.GetBody to avoid this error

when trying to send an email through this library.

Based on research (golang/go#62453, https://github.com/stripe/stripe-go/pull/711/files, https://ragoragino.dev/blog/softwareengineering/2022-02-05-goaway-test/index.html) it looks like Golang attempts a retry when receiving GOAWAY from a server. [https://sourcegraph.com/github.com/golang/net/-/commit/cffdcf672aee934982473246bc7e9a8ba446aa9b?visible=2](Go code here)

But, this means that we need to define a GetBody function in the request to allow the http2 package to retry. Since the payload we have here is static, we can set it equal to the Body.

I tested this by patching my dependency with this new version, and my emails still send, so I think this at least won't break anything.

Copy link

mergify bot commented Jun 12, 2024

Welcome to our open-source project! 💘

@mrz1836 mrz1836 added update General updates bug-P3 Lowest rated bug, affects nearly none or low-impact labels Jun 12, 2024
@mrz1836 mrz1836 self-requested a review June 12, 2024 19:29
@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

Project coverage is 96.75%. Comparing base (6b50666) to head (92fba74).

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #58      +/-   ##
==========================================
- Coverage   97.10%   96.75%   -0.36%     
==========================================
  Files          13       13              
  Lines         552      554       +2     
==========================================
  Hits          536      536              
- Misses          9       10       +1     
- Partials        7        8       +1     
Flag Coverage Δ
unittests 96.75% <0.00%> (-0.36%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
postmark.go 72.72% <0.00%> (-3.47%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6b50666...92fba74. Read the comment docs.

Copy link
Owner

@mrz1836 mrz1836 left a comment

Choose a reason for hiding this comment

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

LGTM

@mrz1836 mrz1836 merged commit 490bfd1 into mrz1836:master Jun 12, 2024
5 checks passed
@vincent-stytch
Copy link
Author

@mrz1836 just wondering what your release process is like? I see the last release v.1.6.4 was on Feb 28 2024 but I was wondering if it would be possible to add a new release? Thanks so much!

@mrz1836
Copy link
Owner

mrz1836 commented Jun 12, 2024

@vincent-stytch usually same day on the release :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-P3 Lowest rated bug, affects nearly none or low-impact update General updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants