Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Removing duplicated code to initialize params #655

Closed
wants to merge 1 commit into from

3 participants

@lscoder

All tests passed

@LoicMahieu
Collaborator

PR is too old. Please rebase it for travis run.

@mikeal
Owner

no longer merges cleanly :(

@mikeal mikeal closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 11, 2013
  1. @lscoder

    Removing duplicated code to initialize params

    lscoder authored
    All tests passed
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 10 deletions.
  1. +4 −10 index.js
View
14 index.js
@@ -38,17 +38,11 @@ function initParams(uri, options, callback) {
function request (uri, options, callback) {
if (typeof uri === 'undefined') throw new Error('undefined is not a valid uri or options object.')
- if ((typeof options === 'function') && !callback) callback = options
- if (options && typeof options === 'object') {
- options.uri = uri
- } else if (typeof uri === 'string') {
- options = {uri:uri}
- } else {
- options = uri
- }
-
- options = copy(options)
+ var params = initParams(uri, options, callback)
+ options = copy(params.options)
+ callback = params.callback
+
if (callback) options.callback = callback
var r = new Request(options)
return r
Something went wrong with that request. Please try again.