Fixed #469 Added requireAccessToken()
method to senders
#595
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.
Description of the change
We have three different built in payload senders that take a payload and send it to the Rollbar service. Some require that the payload include the access token. The
Rollbar\Senders\CurlSender
class is one of these. Our other two built in senders can use an external access token. TheRollbar\Senders\FluentSender
is does not need the access token. And it was causing issues (see #469).This proposed change moves the requirement for knowing if the access token is required from the
Rollbar/Config
class to the configured sender. All senders must implementRollbar\Senders\SenderInterface
. So, I added a newrequireAccessToken()
method to theSenderInterface
. The method returns aboolean
indicating if the sender requires the access token. This method is called during the initialization process. If the access token is required and not valid an error is thrown.The reason this is a breaking change is because it requires the
requireAccessToken()
method be added to all custom sender interfaces.An argument could be made that the
Rollbar\Senders\AgentSender
does not require the access token. For now, I am going to stick with the conclusion from #405, and leave it the way it is.Type of change
Related issues
handler
configuration parameter is set #469Checklists
Development
Code review