mirror of
https://github.com/78/xiaozhi-esp32.git
synced 2026-01-14 01:07:30 +08:00
fix ota post field
This commit is contained in:
parent
e25bf7155d
commit
001c17f2d2
@ -32,13 +32,18 @@ void FirmwareUpgrade::CheckVersion() {
|
||||
esp_http_client_set_method(client, HTTP_METHOD_POST);
|
||||
esp_http_client_set_header(client, "Content-Type", "application/json");
|
||||
esp_http_client_set_header(client, "Device-Id", SystemInfo::GetMacAddress().c_str());
|
||||
esp_http_client_set_post_field(client, device_info.c_str(), device_info.length());
|
||||
esp_err_t err = esp_http_client_open(client, 0);
|
||||
esp_err_t err = esp_http_client_open(client, device_info.length());
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Failed to perform HTTP request: %s", esp_err_to_name(err));
|
||||
esp_http_client_cleanup(client);
|
||||
return;
|
||||
}
|
||||
auto written = esp_http_client_write(client, device_info.data(), device_info.length());
|
||||
if (written < 0) {
|
||||
ESP_LOGE(TAG, "Failed to write request body: %s", esp_err_to_name(err));
|
||||
esp_http_client_cleanup(client);
|
||||
return;
|
||||
}
|
||||
int content_length = esp_http_client_fetch_headers(client);
|
||||
if (content_length <= 0) {
|
||||
ESP_LOGE(TAG, "Failed to fetch headers");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user