From 472752af14d39d04f07073f72b12bcc169cf01db Mon Sep 17 00:00:00 2001 From: Vsevolod Strukchinsky Date: Tue, 21 Apr 2015 19:07:03 +0500 Subject: [PATCH] don't erase callback on helpers methods https://github.com/sindresorhus/npm-name/issues/2 --- index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/index.js b/index.js index fc2776c..466c815 100644 --- a/index.js +++ b/index.js @@ -205,6 +205,11 @@ function got(url, opts, cb) { 'delete' ].forEach(function (el) { got[el] = function (url, opts, cb) { + if (typeof opts === 'function') { + cb = opts; + opts = undefined; + } + return got(url, objectAssign({}, opts, {method: el.toUpperCase()}), cb); }; });