Skip to content

Commit

Permalink
SwaggerOperation.do assumes that endpoints always
Browse files Browse the repository at this point in the history
have parameters, but they don't. Therefore, sometimes
a method will be called with just a callback.
logic added to prefer that a single argument be
a callback. Note this will still fail if an
callback and an error method are given.
  • Loading branch information
Will Fitzgerald committed Mar 31, 2012
1 parent 71468ef commit 3a76cf8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/swagger.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/swagger.coffee
Expand Up @@ -117,7 +117,10 @@ class SwaggerOperation
@do(args, callback, error)

do: (args={}, callback, error) =>


# if no callback, must be being called without parameters
callback = args if (args? and !callback?)

# Define a default error handler
unless error?
error = (xhr, textStatus, error) -> console.log xhr, textStatus, error
Expand Down

0 comments on commit 3a76cf8

Please sign in to comment.