From e2d95f76baf352d050fd35b2f4d7b8c65e17d25e Mon Sep 17 00:00:00 2001 From: Thashmi-nil Date: Sat, 8 Apr 2023 00:17:49 +0530 Subject: [PATCH] Fix chat history persisting issue --- .../ui/request/interceptor/HubspotHandler.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/HubspotHandler.java b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/HubspotHandler.java index b649d341fe5..e489f1883c2 100644 --- a/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/HubspotHandler.java +++ b/components/ui-request-interceptor/io.entgra.ui.request.interceptor/src/main/java/io/entgra/ui/request/interceptor/HubspotHandler.java @@ -26,6 +26,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.http.HttpHeaders; import org.apache.http.HttpStatus; +import org.apache.http.client.methods.HttpDelete; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; @@ -86,6 +87,21 @@ public class HubspotHandler extends HttpServlet { } } + @Override + protected void doDelete(HttpServletRequest req, HttpServletResponse resp){ + try{ + if(validateRequest(req, resp)){ + HttpDelete deleteRequest = new HttpDelete(HandlerUtil.generateBackendRequestURL(req,hubspotEndpoint)); + deleteRequest.setHeader(HttpHeaders.CONTENT_TYPE, "application/json"); + deleteRequest.setHeader(HttpHeaders.AUTHORIZATION, HandlerConstants.BEARER + chatConfig); + ProxyResponse proxyResponse = HandlerUtil.execute(deleteRequest); + HandlerUtil.handleSuccess(resp, proxyResponse); + } + } catch (IOException e){ + log.error("Error occurred when processing DELETE request.", e); + } + } + /*** * Validates the hubspot's incoming request. *