Skip to content

Commit

Permalink
correct parameter names for mtarget multiparts
Browse files Browse the repository at this point in the history
  • Loading branch information
nicpottier committed Feb 15, 2018
1 parent b302c02 commit 1712735
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions handlers/mtarget/mtarget.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,17 +70,17 @@ func (h *handler) receiveMsg(ctx context.Context, c courier.Channel, w http.Resp

// if we have a long message id, then this is part of a multipart message, we don't write the message until
// we have received all parts, which we buffer in Redis
longID := r.Form.Get("msglong_id")
longID := r.Form.Get("msglong.id")
if longID != "" {
longCount, _ := strconv.Atoi(r.Form.Get("msglong_msgcount"))
longRef, _ := strconv.Atoi(r.Form.Get("msglong_msgref"))
longCount, _ := strconv.Atoi(r.Form.Get("msglong.msgcount"))
longRef, _ := strconv.Atoi(r.Form.Get("msglong.msgref"))

if longCount == 0 || longRef == 0 {
return nil, courier.WriteAndLogRequestError(ctx, w, r, c, fmt.Errorf("invalid or missing 'msglong_msgcount' or 'msglong_msgref' parameters"))
return nil, courier.WriteAndLogRequestError(ctx, w, r, c, fmt.Errorf("invalid or missing 'msglong.msgcount' or 'msglong.msgref' parameters"))
}

if longRef < 1 || longRef > longCount {
return nil, courier.WriteAndLogRequestError(ctx, w, r, c, fmt.Errorf("'msglong_msgref' needs to be between 1 and 'msglong_msgcount' inclusive"))
return nil, courier.WriteAndLogRequestError(ctx, w, r, c, fmt.Errorf("'msglong.msgref' needs to be between 1 and 'msglong.msgcount' inclusive"))
}

rc := h.Backend().RedisPool().Get()
Expand Down
4 changes: 2 additions & 2 deletions handlers/mtarget/mtarget_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ var (
receiveStop = "Msisdn=+923161909799&Content=Stop&Keyword=Stop"
receiveMissingFrom = "Content=hello&Keyword=Default"

receivePart2 = "Msisdn=+923161909799&Content=world&Keyword=Default&msglong_id=longmsg&msglong_msgcount=2&msglong_msgref=2"
receivePart1 = "Msisdn=+923161909799&Content=hello+&Keyword=Default&msglong_id=longmsg&msglong_msgcount=2&msglong_msgref=1"
receivePart2 = "Msisdn=+923161909799&Content=world&Keyword=Default&msglong.id=longmsg&msglong.msgcount=2&msglong.msgref=2"
receivePart1 = "Msisdn=+923161909799&Content=hello+&Keyword=Default&msglong.id=longmsg&msglong.msgcount=2&msglong.msgref=1"

statusURL = "/c/mt/8eb23e93-5ecb-45ba-b726-3b064e0c56ab/status"

Expand Down

0 comments on commit 1712735

Please sign in to comment.