Skip to content

Commit

Permalink
Merge pull request subosito#6 from monzo/master
Browse files Browse the repository at this point in the history
Params for /Messages should be query string params not body
  • Loading branch information
Alif Rachmawadi authored Sep 1, 2016
2 parents 6fe3f66 + e8714b2 commit ef2f135
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion message.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,18 @@ func (s *MessageService) List(params MessageListParams) ([]Message, *Response, e
u := s.client.EndPoint("Messages")
v := structToUrlValues(&params)

req, _ := s.client.NewRequest("GET", u.String(), strings.NewReader(v.Encode()))
req, _ := s.client.NewRequest("GET", u.String(), nil)

// params are url query params
q := req.URL.Query()
for k, vals := range v {
for _, v := range vals {
if v != "" { // only set for non blank values
q.Add(k, v)
}
}
}
req.URL.RawQuery = q.Encode()

// Helper struct for handling the listing
type list struct {
Expand Down

0 comments on commit ef2f135

Please # to comment.