feat: #4273 - courier http channel - Include error response from email service provider in courier logs#4274
Open
hvsharma wants to merge 1 commit intoory:masterfrom
Conversation
…ce provider in courier logs This change includes error response sent by email service provider when http channel is used and email sending fails due to some reason. Currently only response code is included in courier logs when email sending api call is made. This makes it hard to obtain further information on the actual error.
aeneasr
requested changes
Feb 13, 2025
| res.StatusCode, | ||
| "unable to dispatch mail delivery because upstream server replied with status code %d and body: %s", | ||
| res.StatusCode, | ||
| bytes.NewBuffer(x.MustReadAll(res.Body)).String(), |
Member
There was a problem hiding this comment.
Please properly handle the error of the stream reader here (in this case ignore the error and log an empty body) as otherwise this can panic. Otherwise LGTM. Also you don‘t need to create a buffer.
Contributor
There was a problem hiding this comment.
We're also never closing the response body here. And we must have an io.LimitReader to avoid reading unbounded data.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
4273 - courier http channel - Include error response from email service provider in courier logs
Related issue(s)
#4273
Checklist
introduces a new feature.
contributing code guidelines.
vulnerability. If this pull request addresses a security vulnerability, I
confirm that I got the approval (please contact
[email protected]) from the maintainers to push
the changes.
works.
Further Comments