Skip to content

Commit

Permalink
explicit type checks for existence
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg committed Feb 23, 2017
1 parent d09d0f0 commit 0dc85d4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions jsonist.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,16 @@ function makeMethod (method, data) {
} else
options = xtend(options, {})

if (!options.method)
if (typeof options.method != 'string')
options.method = method

if (!options.headers)
if (typeof options.headers != 'object')
options.headers = {}

if (data && !options.headers['content-type'])
if (data && typeof options.headers['content-type'] != 'string')
options.headers['content-type'] = 'application/json'

if (!options.headers['accept'])
if (typeof options.headers['accept'] != 'string')
options.headers['accept'] = 'application/json'

return collector(uri, options, callback)
Expand Down

0 comments on commit 0dc85d4

Please sign in to comment.