Skip to content

Commit

Permalink
Set UseNumber when decoding message bodies
Browse files Browse the repository at this point in the history
Preserves number formatting when unmarshalling numbers to interface{}.
  • Loading branch information
adamcfraser committed Oct 17, 2018
1 parent 0a96d2f commit 9769dbb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion message.go
Expand Up @@ -180,7 +180,9 @@ func (m *Message) ReadJSONBody(value interface{}) error {
if bodyReader, err := m.BodyReader(); err != nil {
return err
} else {
return json.NewDecoder(bodyReader).Decode(value)
decoder := json.NewDecoder(bodyReader)
decoder.UseNumber()
return decoder.Decode(value)
}
}

Expand Down

0 comments on commit 9769dbb

Please sign in to comment.