Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

`commonMethod()` now returns in same form as `request()` #1

Merged
merged 1 commit into from

2 participants

@tapvt

Hey Dave,

This is an update that will break existing usage of the discovery client, but I feel it is a valuable improvement.

The change allows access to the contents of request's res value, which contains essential information like the HTTP statusCode. Developers familiar and comfortable with request() will be right at home.

I've already monkey-patched this into our codebase, as I needed access to the HTTP status code to determine what was going on with a request.

@tapvt tapvt commonMethod() now has same return as a standard request()
This allows access to the contents of request's `res` value, which contains essential information like the HTTP statusCode.
1e4d39b
@dbrand666 dbrand666 merged commit 7c26749 into dbrand666:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 14, 2013
  1. @tapvt

    commonMethod() now has same return as a standard request()

    tapvt authored
    This allows access to the contents of request's `res` value, which contains essential information like the HTTP statusCode.
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/discovery-services-client.js
View
4 lib/discovery-services-client.js
@@ -165,7 +165,7 @@ function processMethods(initOpts, baseUrl, methods, resourceEntry, cb) {
This is a jslint-approved version. The downside is that all the
generated functions are anonymous - any stack traces will be a
bit harder to chase down.
-
+
resourceEntry[name] = async.apply(commonMethod, {
apiKey: initOpts.apiKey,
baseUrl: baseUrl,
@@ -221,7 +221,7 @@ function commonMethod(data, options, cb) {
uri: uri,
json: true
}, function (err, res, body) {
- cb(err, body);
+ cb(err, res, body);
});
}
Something went wrong with that request. Please try again.