Closed michaelbeaumont closed 3 years ago
@michaelbeaumont I would suggest adding something like:
id := strings.TrimLeft(url.Path, "/")
This will make sure that we don't get the /
in front of every charging station ID, makes it easier to parse the ID into an int if necessary.
Base
has the same behavior in the simple case of /CPID
. But TrimLeft
only removes one leading /
, so if my listenPath
is /ocpp
then my ID will end up ocpp/CPID
. With Base
I get CPID
, which is the ID as defined by the spec. By the way, nothing guarantees charge point IDs are integers.
This could be construed as a breaking change if users depend on the existing behavior but it's also a bug.
Indeed a breaking change 😅 I'm just wondering: is there any use case, in which CSMS operators would want the "full" path to be returned, instead of just the ID of the charging station?
I don't think so. Of course, only if the path differs, but... the listenPath
is fixed per server.
And if they do, it shouldn't be available as the "ID" since that has a defined meaning.
This could be construed as a breaking change if users depend on the existing behavior but it's also a bug.