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

Adding SendGrid response handling #709

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

nicbavetta
Copy link

@nicbavetta nicbavetta commented Feb 15, 2021

Per request, I have stripped down my last pull request to exclude any additional/unrelated refactoring.

There were several tests failing prior to my work. These tests will also fail in the automated build. They are unrelated to my work and should be ignored when evaluating my pull request.

This pull request contains modifications to enable extensibility through SendGrid API response handling. Previously, if a response from the SendGrid API indicated a result other than success (defined, by this extension, as status code >= 300), an exception would be thrown when the SendGridMessageAsyncCollector was flushed. This implementation made it difficult to react to responses in meaningful ways.

Additions

  1. ISendGridResponseHandler - This interface can be implemented to allow business logic to be executed against responses from the SendGrid API.

  2. DefaultSendGridResponseHandler - The default implementation for the interface above. If consumers of this extension do not implement and register the ISendGridResponseHandler with DI, then the DefaultSendGridResponseHandler will be used. This handler implements the logic that was previously implemented when SendGrid responses were received with status codes >= 300. The status code evaluation has been changed to >= 400, per SendGrid documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant