From 886468e472fceec78fa2b7dca0b1257bb453a085 Mon Sep 17 00:00:00 2001 From: adjoly Date: Tue, 8 Jul 2025 11:44:15 +0200 Subject: [PATCH] =?UTF-8?q?=E3=80=8C=F0=9F=94=A8=E3=80=8D=20fix:=20fixed?= =?UTF-8?q?=20delete?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- includes/requests/RequestImplement.hpp | 3 ++- sample.toml | 2 +- src/requests_handling/requestImplementation/Delete.cpp | 9 ++++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/includes/requests/RequestImplement.hpp b/includes/requests/RequestImplement.hpp index 8c84636..ca8677f 100644 --- a/includes/requests/RequestImplement.hpp +++ b/includes/requests/RequestImplement.hpp @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/04/30 09:30:15 by adjoly #+# #+# */ -/* Updated: 2025/05/30 16:19:06 by adjoly ### ########.fr */ +/* Updated: 2025/07/08 11:42:46 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -59,6 +59,7 @@ class Delete : public ARequest { public: Delete(void) {} Delete(std::string &data, config::Server *srv); + ~Delete(); void parse(std::string const &data); diff --git a/sample.toml b/sample.toml index d32a357..48edece 100644 --- a/sample.toml +++ b/sample.toml @@ -4,5 +4,5 @@ port = 2727 [server.location./] root = "./exemples/webpage" -methods = { "GET", "POST" } +methods = { "GET", "POST", "DELETE" } cgi = { ".py"} diff --git a/src/requests_handling/requestImplementation/Delete.cpp b/src/requests_handling/requestImplementation/Delete.cpp index 6cddfb6..69865d7 100644 --- a/src/requests_handling/requestImplementation/Delete.cpp +++ b/src/requests_handling/requestImplementation/Delete.cpp @@ -6,7 +6,7 @@ /* By: adjoly +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/04/30 09:42:18 by adjoly #+# #+# */ -/* Updated: 2025/07/07 19:06:38 by mmoussou ### ########.fr */ +/* Updated: 2025/07/08 11:43:21 by adjoly ### ########.fr */ /* */ /* ************************************************************************** */ @@ -46,6 +46,8 @@ void Delete::parse(std::string const &data) { this->_headers.insert(std::make_pair(key, _sanitizeStr(value))); } } + + _route = _srv->whatRoute(URL(_target)); std::ostringstream body_stream; while (std::getline(stream, line)) @@ -69,6 +71,11 @@ void Delete::parse(std::string const &data) { */ } +Delete::~Delete(void) { + if (_url != not_nullptr) + delete _url; +} + Response Delete::execute(void) { http::Response response;