lorenzodonini / ocpp-go

Open Charge Point Protocol implementation in Go
MIT License
275 stars 126 forks source link

Fix empty request and response bodies #122

Closed hevanto closed 2 years ago

hevanto commented 2 years ago

I noticed some charge points send an empty body rather than an empty object '{}' for requests that do not have properties. E.g. Heartbeat.

This causes a panic in the library. I fixed this by creating an empty object when the input is a nil pointer.

lorenzodonini commented 2 years ago

Nice catch and thanks for submitting the PR.

I'd argue that sending a nil body is a bug in the charge point implementation, since this is not considered in the specs, but regardless this is a welcome improvement. I'll write a test for this later on.