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.
This commit is contained in:
parent
bd41334265
commit
93bcf5f250
@ -58,6 +58,11 @@ HTTPUpdateResult HTTPUpdate::update(WiFiClient& client, const String& url, const
|
|||||||
return handleUpdate(http, currentVersion, false);
|
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)
|
HTTPUpdateResult HTTPUpdate::updateSpiffs(WiFiClient& client, const String& url, const String& currentVersion)
|
||||||
{
|
{
|
||||||
HTTPClient http;
|
HTTPClient http;
|
||||||
@ -68,6 +73,12 @@ HTTPUpdateResult HTTPUpdate::updateSpiffs(WiFiClient& client, const String& url,
|
|||||||
return handleUpdate(http, currentVersion, true);
|
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,
|
HTTPUpdateResult HTTPUpdate::update(WiFiClient& client, const String& host, uint16_t port, const String& uri,
|
||||||
const String& currentVersion)
|
const String& currentVersion)
|
||||||
{
|
{
|
||||||
|
@ -86,6 +86,10 @@ public:
|
|||||||
|
|
||||||
t_httpUpdate_return updateSpiffs(WiFiClient& client, const String& url, const String& currentVersion = "");
|
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 ¤tVersion = "");
|
||||||
|
|
||||||
int getLastError(void);
|
int getLastError(void);
|
||||||
String getLastErrorString(void);
|
String getLastErrorString(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user