@belmonddev/catch-request-express-middleware 3.2.3 → 3.2.4

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.
Files changed (2) hide show
  1. package/index.js +2 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -56,7 +56,7 @@ const catchHttpResponse = (reqObject, responseCb) => {
56
56
  });
57
57
  };
58
58
 
59
- const transformHeaderValues = (headers) => {
59
+ const transformHeaderValues = (headers = {}) => {
60
60
  let transformedHeaders = {};
61
61
  const headerEntries = Object.entries(headers);
62
62
  headerEntries.forEach(([key, value]) => {
@@ -73,7 +73,7 @@ const overrideHttpModule = (httpModule, requestSentCb) => {
73
73
 
74
74
  // transform headers to use array values instead of string
75
75
  const headers = transformHeaderValues(request.headers);
76
- const contentLength = getHeaderValue(headers || {}, 'content-length');
76
+ const contentLength = getHeaderValue(headers, 'content-length');
77
77
  const requestHasBody = !!contentLength;
78
78
 
79
79
  const [pathname, query] = request.path.split('?');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@belmonddev/catch-request-express-middleware",
3
- "version": "3.2.3",
3
+ "version": "3.2.4",
4
4
  "main": "index.js",
5
5
  "author": "David Escalera",
6
6
  "license": "ISC",