[http_request] Add enum for status codes (#7690)

This commit is contained in:
Clyde Stubbs authored and GitHub committed 2024-10-29 16:05:58 +13:00
1 parent 63e4d4b493
commit df750d0d11
5 files changed
+65 -15

No files matched your search

@@ -113,7 +113,7 @@ std::shared_ptr<HttpContainer> HttpRequestArduino::start(std::string url, std::s
return nullptr;
}
if (container->status_code < 200 || container->status_code >= 300) {
if (!is_success(container->status_code)) {
ESP_LOGE(TAG, "HTTP Request failed; URL: %s; Code: %d", url.c_str(), container->status_code);
this->status_momentary_error("failed", 1000);
// Still return the container, so it can be used to get the status code and error message