Skip to content

_http.getStream() replace with getString. #162

Open
@JurePotocnik

Description

@JurePotocnik

I do not know it's just me or we could make same change.
When downloading the versions.json file we connect to server, open stream and deserializeJson with stream as input. In my case, the stream is always null, so i change it to getString, which actually returns the json content and then convert to json.

File: esp32FOTA.cpp:849

Current code:
// TODO: use payload.length() to speculate on JSONResult buffer size #define JSON_FW_BUFF_SIZE 2048 DynamicJsonDocument JSONResult( JSON_FW_BUFF_SIZE ); DeserializationError err = deserializeJson( JSONResult, _http.getStream() );

Changed code:
// TODO: use payload.length() to speculate on JSONResult buffer size #define JSON_FW_BUFF_SIZE 2048 DynamicJsonDocument JSONResult( JSON_FW_BUFF_SIZE ); String jsonString = _http.getString(); DeserializationError err = deserializeJson( JSONResult, jsonString );

I know that in this case, I am using some additional memory for the String but in that case it work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions