Skip to content

Commit

Permalink
Merge pull request #44 from Shubham4026/bakend_feature
Browse files Browse the repository at this point in the history
Fixed validation Issue in URL
  • Loading branch information
snehal0904 authored Nov 4, 2024
2 parents 1d54678 + b439c04 commit 89e9fb9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/common/middleware/middleware.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,16 @@ export class MiddlewareServices {
let fullUrl = `${microserviceUrl}${forwardUrl}`;

//get userId
const payload = req.headers['authorization'].split('.')[1]; // Get the payload part
const decodedPayload = atob(payload); // Decode the base64 payload
const parsedPayload = JSON.parse(decodedPayload);
let userId = parsedPayload.sub;
if (userId) {
if(req?.headers['authorization']){
const payload = req.headers['authorization'].split('.')[1]; // Get the payload part
const decodedPayload = atob(payload); // Decode the base64 payload
const parsedPayload = JSON.parse(decodedPayload);
let userId = parsedPayload.sub;
if (userId) {
fullUrl =
fullUrl +
(fullUrl.includes('?') ? `&userId=${userId}` : `?userId=${userId}`);
}
}
// Handle multipart/form-data
if (req.is('multipart/form-data')) {
Expand Down

0 comments on commit 89e9fb9

Please sign in to comment.