diff --git a/src/common/middleware/middleware.service.ts b/src/common/middleware/middleware.service.ts index aa84ac2..55213e9 100644 --- a/src/common/middleware/middleware.service.ts +++ b/src/common/middleware/middleware.service.ts @@ -160,6 +160,7 @@ export class MiddlewareServices { return await this.gatewayService.handleRequestForMultipartData( res, fullUrl, + req.method, formData, token, ); diff --git a/src/middleware/gateway.service.ts b/src/middleware/gateway.service.ts index 3088b6e..f363203 100644 --- a/src/middleware/gateway.service.ts +++ b/src/middleware/gateway.service.ts @@ -75,17 +75,24 @@ export class GatewayService { async handleRequestForMultipartData( res, url: string, + method, formData: any, token?: string, ) { try { - const response = await axios.patch(url, formData, { - headers: { - ...formData.getHeaders(), - ...(token ? { Authorization: `Bearer ${token}` } : {}), - }, + let response; + const headers = { + ...formData.getHeaders(), + ...(token ? { Authorization: `Bearer ${token}` } : {}), + }; + response = await axios({ + method: method.toLowerCase(), + url, + data: formData, + headers, }); + res.locals.responseBody = response.data; res.status(response.status); return response.data;