From 6c0f95023dcf37eb8274915368b9849bf3a958c5 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Tue, 24 Apr 2018 13:22:24 -0700 Subject: [PATCH] style --- index.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 17a473f5..02cfb0c1 100644 --- a/index.js +++ b/index.js @@ -19,13 +19,14 @@ function simpleGet (opts, cb) { if (opts.method) opts.method = opts.method.toUpperCase() var body - if (opts.form) body = typeof opts.form === 'string' ? opts.form : querystring.stringify(opts.form) - if (opts.body) body = opts.json && !isStream(opts.body) ? JSON.stringify(opts.body) : opts.body - if (opts.json) opts.headers.accept = 'application/json' if (opts.form) opts.headers['content-type'] = 'application/x-www-form-urlencoded' - delete opts.body - delete opts.form + if (opts.body) { + body = opts.json && !isStream(opts.body) ? JSON.stringify(opts.body) : opts.body + } else if (opts.form) { + body = typeof opts.form === 'string' ? opts.form : querystring.stringify(opts.form) + } + delete opts.body; delete opts.form if (body) { if (!opts.method) opts.method = 'POST'