I would like to suggest a change to the parseFirmwareMessage method. It resets the url and token before it checks if the message is actually a firmware message. Could we relocate the resetting to after the check if a message is a firmware message? It would reduce the chance of a deletion of a valid URL and token.
My suggestion:
bool HttpFirmwareDownload::parseFirmwareMessage(char message[], int messageLength) {
if (!isFirmwareMessage(message, messageLength)) {
return false;
}
_url.set(nullptr);
_token.set(nullptr);
int start = getHttpBodyStart(message, messageLength);
_firmwareMessage.fromJson(&message[start]);
return _url.get() != nullptr && _token.get() != nullptr;
}
I would like to suggest a change to the parseFirmwareMessage method. It resets the url and token before it checks if the message is actually a firmware message. Could we relocate the resetting to after the check if a message is a firmware message? It would reduce the chance of a deletion of a valid URL and token.
My suggestion:
I can create a PR if needed.