From 0190f60593f1aef5c40a8e4c73d51cf2d6f68a48 Mon Sep 17 00:00:00 2001 From: karan Date: Fri, 17 Aug 2018 15:27:23 +0530 Subject: [PATCH] fixed Cannot redefine property: clientIp error --- dist/index.js | 3 ++- src/index.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dist/index.js b/dist/index.js index c596fb7..7dd4ba4 100644 --- a/dist/index.js +++ b/dist/index.js @@ -153,7 +153,8 @@ function mw(options) { Object.defineProperty(req, attributeName, { get: function get() { return ip; - } + }, + configurable: true }); next(); }; diff --git a/src/index.js b/src/index.js index 2460c37..24495cc 100644 --- a/src/index.js +++ b/src/index.js @@ -143,6 +143,7 @@ function mw(options) { const ip = getClientIp(req); Object.defineProperty(req, attributeName, { get: () => ip, + configurable: true }); next(); };