diff --git a/lib/node/agent.js b/lib/node/agent.js index 2b9d912e1..a88dfa3a0 100644 --- a/lib/node/agent.js +++ b/lib/node/agent.js @@ -55,7 +55,13 @@ Agent.prototype.attachCookies = function(req){ }; // generate HTTP verb methods -methods.indexOf('del') == -1 && methods.push('del'); +if (methods.indexOf('del') == -1) { + // create a copy so we don't cause conflicts with + // other packages using the methods package and + // npm 3.x + methods = methods.slice(0); + methods.push('del'); +} methods.forEach(function(method){ var name = method; method = 'del' == method ? 'delete' : method; diff --git a/lib/node/index.js b/lib/node/index.js index e2bb934b6..442debc46 100644 --- a/lib/node/index.js +++ b/lib/node/index.js @@ -1162,7 +1162,13 @@ function request(method, url) { } // generate HTTP verb methods -methods.indexOf('del') == -1 && methods.push('del'); +if (methods.indexOf('del') == -1) { + // create a copy so we don't cause conflicts with + // other packages using the methods package and + // npm 3.x + methods = methods.slice(0); + methods.push('del'); +} methods.forEach(function(method){ var name = method; method = 'del' == method ? 'delete' : method;