HTTP_DELETE error - Request method for this URI is not handled by server

Pedrojdi
Posts: 9
Joined: Mon Mar 08, 2021 2:14 pm

HTTP_DELETE error - Request method for this URI is not handled by server

Postby Pedrojdi » 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

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
};

Pedrojdi
Posts: 9
Joined: Mon Mar 08, 2021 2:14 pm

Re: HTTP_DELETE error - Request method for this URI is not handled by server

Postby Pedrojdi » Mon Jun 06, 2022 8:15 pm

I managed to get it right mate, I ended up forgetting to put .uri = "/api/testWs/*"
everything working now, thank you very much

Who is online

Users browsing this forum: No registered users and 125 guests