Skip to content

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
feross committed Apr 24, 2018
1 parent 56c10dc commit 83c57e1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ function simpleGet (opts, cb) {
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.json && body) opts.headers['content-type'] = 'application/json'
if (opts.form) opts.headers['content-type'] = 'application/x-www-form-urlencoded'
if (body && !isStream(body)) opts.headers['content-length'] = Buffer.byteLength(body)
delete opts.body
delete opts.form

if (body && !opts.method) opts.method = 'POST'
if (body) {
if (!opts.method) opts.method = 'POST'
if (!isStream(body)) opts.headers['content-length'] = Buffer.byteLength(body)
if (opts.json) opts.headers['content-type'] = 'application/json'
}

// Request gzip/deflate
var customAcceptEncoding = Object.keys(opts.headers).some(function (h) {
Expand Down

0 comments on commit 83c57e1

Please sign in to comment.