-
Notifications
You must be signed in to change notification settings - Fork 71
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
Fix setting of log type of channel logs and add additional types #605
Conversation
@@ -23,9 +23,11 @@ const ( | |||
ChannelLogTypeMsgStatus ChannelLogType = "msg_status" | |||
ChannelLogTypeMsgReceive ChannelLogType = "msg_receive" | |||
ChannelLogTypeEventReceive ChannelLogType = "event_receive" | |||
ChannelLogTypeMultiReceive ChannelLogType = "multi_receive" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when a payload can contain a mixture of things
d8e0ff1
to
92fa928
Compare
Codecov Report
@@ Coverage Diff @@
## main #605 +/- ##
==========================================
+ Coverage 74.38% 74.46% +0.08%
==========================================
Files 98 98
Lines 13153 13188 +35
==========================================
+ Hits 9784 9821 +37
+ Misses 2670 2668 -2
Partials 699 699
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@@ -35,7 +35,7 @@ func init() { | |||
// Initialize is called by the engine once everything is loaded | |||
func (h *handler) Initialize(s courier.Server) error { | |||
h.SetServer(s) | |||
s.AddHandlerRoute(h, http.MethodPost, "receive", h.receiveMessage) | |||
s.AddHandlerRoute(h, http.MethodPost, "receive", courier.ChannelLogTypeUnknown, h.receiveMessage) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for routes where we can't know until we parse the payload.. it's set manually with SetType
in the method
// receiveEvent is our HTTP handler function for incoming messages and status updates | ||
func (h *handler) receiveEvent(ctx context.Context, channel courier.Channel, w http.ResponseWriter, r *http.Request, payload *moPayload, clog *courier.ChannelLog) ([]courier.Event, error) { | ||
// receiveEvents is our HTTP handler function for incoming messages and status updates | ||
func (h *handler) receiveEvents(ctx context.Context, channel courier.Channel, w http.ResponseWriter, r *http.Request, payload *moPayload, clog *courier.ChannelLog) ([]courier.Event, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed for clarity
handlers/mblox/mblox.go
Outdated
@@ -62,6 +62,8 @@ var statusMapping = map[string]courier.MsgStatusValue{ | |||
// receiveEvent is our HTTP handler function for incoming messages | |||
func (h *handler) receiveEvent(ctx context.Context, channel courier.Channel, w http.ResponseWriter, r *http.Request, payload *eventPayload, clog *courier.ChannelLog) ([]courier.Event, error) { | |||
if payload.Type == "recipient_delivery_report_sms" { | |||
clog.SetType(courier.ChannelLogTypeEventReceive) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be be courier.ChannelLogTypeMsgStatus
?
92fa928
to
c8e241b
Compare
No description provided.