HTTP_DELETE error - Request method for this URI is not handled by server
Posted: Mon Jun 06, 2022 7:31 pm
Good afternoon fellow programmers, could you clarify a doubt for me.
I'm create a rest and pasted a snippet of the code. if you have this information to help me I would appreciate it.
The get, put, post methods are working perfectly when I test in the post man, but the delete method when tested gives the following message:
Request method for this URI is not handled by server
Do you know if expressif has not implemented it?
Thank you very much
I'm create a rest and pasted a snippet of the code. if you have this information to help me I would appreciate it.
The get, put, post methods are working perfectly when I test in the post man, but the delete method when tested gives the following message:
Request method for this URI is not handled by server
Do you know if expressif has not implemented it?
Thank you very much
Code: Select all
esp_err_t getTest(httpd_req_t *request) {
httpd_resp_set_status(request, "200 Ok");
httpd_resp_set_hdr(request, "Content-Type", "text/html");
httpd_resp_sendstr(request, "test get");
return ESP_OK;
}
esp_err_t putTest(httpd_req_t *request) {
httpd_resp_set_status(request, "201 Created");
httpd_resp_set_hdr(request, "Content-Type", "text/html");
httpd_resp_sendstr(request, "test Put");
return ESP_OK;
}
esp_err_t postTest(httpd_req_t *request) {
httpd_resp_set_status(request, "200 Ok");
httpd_resp_set_hdr(request, "Content-Type", "text/html");
httpd_resp_sendstr(request, "test Post");
return ESP_OK;
}
esp_err_t testDelete(httpd_req_t *request) {
httpd_resp_set_status(request, "201 Created");
httpd_resp_set_hdr(request, "Content-Type", "text/html");
httpd_resp_sendstr(request, "test delete");
return ESP_OK;
}
const httpd_uri_t get_uri = {
.uri = "/api/testWs",
.method = HTTP_GET,
.handler = testGet,
.user_ctx = NULL
};
const httpd_uri_t put_uri = {
.uri = "/api/testWs",
.method = HTTP_PUT,
.handler = testPut,
.user_ctx = NULL
};
const httpd_uri_t post_uri = {
.uri = "/api/testWs",
.method = HTTP_POST,
.handler = testPost,
.user_ctx = NULL
};
const httpd_uri_t delete_uri = {
.uri = "/api/testeWs",
.method = HTTP_DELETE,
.handler = testDelete,
.user_ctx = NULL
};