propro-utils 1.5.6 → 1.5.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "propro-utils",
3
- "version": "1.5.6",
3
+ "version": "1.5.8",
4
4
  "description": "Auth middleware for propro-auth",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -330,17 +330,20 @@ class AuthMiddleware {
330
330
  }
331
331
  }
332
332
 
333
- const formData = new FormData();
333
+ let headers = {};
334
+ let formData = null;
335
+
334
336
  if (req.file) {
337
+ formData = new FormData();
335
338
  formData.append('file', req.file.buffer, {
336
339
  filename: req.file.originalname,
337
340
  contentType: req.file.mimetype,
338
341
  });
339
- }
340
342
 
341
- let headers = {
342
- ...formData.getHeaders(),
343
- };
343
+ headers = {
344
+ ...formData.getHeaders(),
345
+ };
346
+ }
344
347
 
345
348
  if (accessToken) {
346
349
  headers.Authorization = `Bearer ${accessToken}`;
@@ -354,9 +357,12 @@ class AuthMiddleware {
354
357
 
355
358
  const data = req.file ? formData : req.body;
356
359
 
360
+ console.log('formattedAuthUrl:', formattedAuthUrl);
361
+ console.log('data:', data);
362
+
357
363
  return axios({
358
364
  method: req.method,
359
- url: `${formattedAuthUrl}${path}`,
365
+ url: `${formattedAuthUrl}`,
360
366
  data: data,
361
367
  headers: headers,
362
368
  maxContentLength: Infinity,