Skip to content

Commit 93bcf5f

Browse files
Allow passing custom HTTPClient to HTTPUpdate (#4959)
This enables customizing HTTP headers which adds some extra flexibility. This does not break anything of course because this change introduces a new constructor with a new additional HTTPClient argument for HTTPUpdate class.
1 parent bd41334 commit 93bcf5f

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

Diff for: libraries/HTTPUpdate/src/HTTPUpdate.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ HTTPUpdateResult HTTPUpdate::update(WiFiClient& client, const String& url, const
5858
return handleUpdate(http, currentVersion, false);
5959
}
6060

61+
HTTPUpdateResult HTTPUpdate::updateSpiffs(HTTPClient& httpClient, const String& currentVersion)
62+
{
63+
return handleUpdate(httpClient, currentVersion, true);
64+
}
65+
6166
HTTPUpdateResult HTTPUpdate::updateSpiffs(WiFiClient& client, const String& url, const String& currentVersion)
6267
{
6368
HTTPClient http;
@@ -68,6 +73,12 @@ HTTPUpdateResult HTTPUpdate::updateSpiffs(WiFiClient& client, const String& url,
6873
return handleUpdate(http, currentVersion, true);
6974
}
7075

76+
HTTPUpdateResult HTTPUpdate::update(HTTPClient& httpClient,
77+
const String& currentVersion)
78+
{
79+
return handleUpdate(httpClient, currentVersion, false);
80+
}
81+
7182
HTTPUpdateResult HTTPUpdate::update(WiFiClient& client, const String& host, uint16_t port, const String& uri,
7283
const String& currentVersion)
7384
{

Diff for: libraries/HTTPUpdate/src/HTTPUpdate.h

+4
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ class HTTPUpdate
8686

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

89+
t_httpUpdate_return update(HTTPClient& httpClient,
90+
const String& currentVersion = "");
91+
92+
t_httpUpdate_return updateSpiffs(HTTPClient &httpClient, const String &currentVersion = "");
8993

9094
int getLastError(void);
9195
String getLastErrorString(void);

0 commit comments

Comments
 (0)