Skip to content

Commit

Permalink
Merge pull request #78 from Xitija/main2
Browse files Browse the repository at this point in the history
chore : added log for debugging
  • Loading branch information
Shubham4026 authored Jan 3, 2025
2 parents c873711 + 156b368 commit d64f75c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/common/middleware/middleware.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,13 @@ export class MiddlewareServices {
const parsedPayload = JSON.parse(decodedPayload);
let userId = parsedPayload.sub;
if (userId) {
console.log('in if ', userId);
fullUrl =
fullUrl +
(fullUrl.includes('?') ? `&userId=${userId}` : `?userId=${userId}`);
}
}
console.log('fullUrl', fullUrl);
// Handle multipart/form-data
if (req.is('multipart/form-data')) {
const reqObject = await this.processMultipartForm(req, res);
Expand Down Expand Up @@ -232,7 +234,7 @@ export class MiddlewareServices {
// Prepare FormData for Axios call
prepareFormData(reqObject: any): FormData {
const formData = new FormData();

// Check if there are files to process
if (reqObject.files && reqObject.files.length > 0) {
reqObject.files.forEach((file: any) => {
Expand All @@ -243,17 +245,16 @@ export class MiddlewareServices {
});
});
}

// Append other form data (e.g., text fields)
if (reqObject.data) {
Object.keys(reqObject.data).forEach((key) => {
formData.append(key, reqObject.data[key]);
});
}

return formData;
}


getMicroserviceUrl(url: string): string | undefined {
// Mapping of URL prefixes to their corresponding service configuration keys
Expand Down

0 comments on commit d64f75c

Please sign in to comment.