lorenzodonini / ocpp-go

Open Charge Point Protocol implementation in Go
MIT License
262 stars 125 forks source link

Fix newline in json encoding #174

Closed lorenzodonini closed 1 year ago

lorenzodonini commented 1 year ago

The new json.Encoder approach introduced in https://github.com/lorenzodonini/ocpp-go/pull/168 didn't trim newlines from json messages, which is the default behavior of the Encode function (see reference).

Per OCPP spec a message shouldn't contain any trailing newline. This PR fixes the wrong behavior by trimming the introduced newline at the end of each generated message.