advanced_https_ota_example: Demonstrate use of init_complete_callback to set custom headers

pull/5919/head
Shubham Kulkarni 2020-08-21 12:43:48 +05:30 zatwierdzone przez bot
rodzic c4d16e9f79
commit 78356d1336
1 zmienionych plików z 9 dodań i 0 usunięć

Wyświetl plik

@ -52,6 +52,14 @@ static esp_err_t validate_image_header(esp_app_desc_t *new_app_info)
return ESP_OK;
}
static esp_err_t _http_client_init_cb(esp_http_client_handle_t http_client)
{
esp_err_t err = ESP_OK;
/* Uncomment to add custom headers to HTTP request */
// err = esp_http_client_set_header(http_client, "Custom-Header", "Value");
return err;
}
void advanced_ota_example_task(void *pvParameter)
{
ESP_LOGI(TAG, "Starting Advanced OTA example");
@ -83,6 +91,7 @@ void advanced_ota_example_task(void *pvParameter)
esp_https_ota_config_t ota_config = {
.http_config = &config,
.http_client_init_cb = _http_client_init_cb, // Register a callback to be invoked after esp_http_client is initialized
};
esp_https_ota_handle_t https_ota_handle = NULL;