-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Allow passing custom HTTPClient to HTTPUpdate #4959
Conversation
This enables customizing HTTP headers and adds some extra flexibility.
Wouldn't it make sense to just add something like |
@me-no-dev Well, why not. I pushed this edit as you suggested. |
@@ -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& url, const String& currentVersion) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not need the url
argument :)
t_httpUpdate_return update(HTTPClient& httpClient, const String& host, uint16_t port, const String& uri = "/", | ||
const String& currentVersion = ""); | ||
|
||
t_httpUpdate_return updateSpiffs(HTTPClient &httpClient, const String &url, const String ¤tVersion = ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not need the url
argument :)
@@ -68,6 +73,12 @@ HTTPUpdateResult HTTPUpdate::updateSpiffs(WiFiClient& client, const String& url, | |||
return handleUpdate(http, currentVersion, true); | |||
} | |||
|
|||
HTTPUpdateResult HTTPUpdate::update(HTTPClient& httpClient, const String& host, uint16_t port, const String& uri, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not need the host
, port
and uri
arguments :)
@@ -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& host, uint16_t port, const String& uri = "/", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not need the host
, port
and uri
arguments :)
you forgot to remove some arguments there :) |
These arguments are not required when passing the HTTPClient instead of WiFiClient.
@me-no-dev oh sorry! I did that it in parallel with other work. I removed these redundant arguments. This should be fine now. |
Thanks :) all good now! |
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.