Skip to content

Allow passing custom HTTPClient to HTTPUpdate #4959

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions libraries/HTTPUpdate/src/HTTPUpdate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ HTTPUpdateResult HTTPUpdate::update(WiFiClient& client, const String& url, const
return handleUpdate(http, currentVersion, false);
}

HTTPUpdateResult HTTPUpdate::updateSpiffs(HTTPClient& httpClient, const String& currentVersion)
{
return handleUpdate(httpClient, currentVersion, true);
}

HTTPUpdateResult HTTPUpdate::updateSpiffs(WiFiClient& client, const String& url, const String& currentVersion)
{
HTTPClient http;
Expand All @@ -68,6 +73,12 @@ HTTPUpdateResult HTTPUpdate::updateSpiffs(WiFiClient& client, const String& url,
return handleUpdate(http, currentVersion, true);
}

HTTPUpdateResult HTTPUpdate::update(HTTPClient& httpClient,
const String& currentVersion)
{
return handleUpdate(httpClient, currentVersion, false);
}

HTTPUpdateResult HTTPUpdate::update(WiFiClient& client, const String& host, uint16_t port, const String& uri,
const String& currentVersion)
{
Expand Down
4 changes: 4 additions & 0 deletions libraries/HTTPUpdate/src/HTTPUpdate.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ class HTTPUpdate

t_httpUpdate_return updateSpiffs(WiFiClient& client, const String& url, const String& currentVersion = "");

t_httpUpdate_return update(HTTPClient& httpClient,
const String& currentVersion = "");

t_httpUpdate_return updateSpiffs(HTTPClient &httpClient, const String &currentVersion = "");

int getLastError(void);
String getLastErrorString(void);
Expand Down