fixed content type for dynamic resources, added for test modem command

with callback
This commit is contained in:
Bogdan Pilyugin 2024-02-04 17:53:53 +02:00
parent a0ec795652
commit 6c20a210f9
3 changed files with 15 additions and 1 deletions

View File

@ -70,6 +70,10 @@ static esp_err_t set_content_type_from_file(httpd_req_t *req,
{
return httpd_resp_set_type(req, "font/woff2");
}
else if (IS_FILE_EXT(filename, ".json"))
{
return httpd_resp_set_type(req, "application/json");
}
/* This is a limited set only */
/* For any other type always set as plain text */
return httpd_resp_set_type(req, "text/plain");

View File

@ -331,9 +331,15 @@ void ModemSendAT(char *cmd, char *resp, int timeout)
ESP_LOGI(TAG, "Response:%s", resp);
}
esp_err_t cmd_cb(uint8_t* data, int len)
{
ESP_LOGI(TAG, "Response:%*s", len, data);
return ESP_OK;
}
void ModemSendSMS(void)
{
esp_modem_command(dce, "atd", &cmd_cb, 3000);
}
#endif

View File

@ -147,6 +147,10 @@ static esp_err_t set_content_type_from_file(httpd_req_t *req,
{
return httpd_resp_set_type(req, "font/woff2");
}
else if (IS_FILE_EXT(filename, ".json"))
{
return httpd_resp_set_type(req, "application/json");
}
/* This is a limited set only */
/* For any other type always set as plain text */
return httpd_resp_set_type(req, "text/plain");