Upgraded dependencies and added response code to output #22

Closed
wants to merge 3 commits into
from
Jump to file or symbol
Failed to load files and symbols.
+53 −33
Split
View
5 app.js
@@ -341,7 +341,7 @@ function processRequest(req, res, next) {
console.log(apiSecret);
console.log(accessToken);
console.log(accessTokenSecret);
-
+
var oa = new OAuth(apiConfig.oauth.requestURL || null,
apiConfig.oauth.accessURL || null,
apiKey || null,
@@ -555,6 +555,7 @@ function processRequest(req, res, next) {
// Set Headers and Call
req.resultHeaders = response.headers;
+ req.code = response.statusCode;
req.call = url.parse(options.host + options.path);
req.call = url.format(req.call);
@@ -590,7 +591,7 @@ app.dynamicHelpers({
req.params.api = pathName;
}
});
- }
+ }
// If the cookie says we're authed for this particular API, set the session to authed as well
if (req.params.api && req.session[req.params.api] && req.session[req.params.api]['authed']) {
req.session['authed'] = true;
View
@@ -21,11 +21,14 @@
"url": "git://github.com/mashery/iodocs.git"
},
"dependencies": {
- "connect-redis": "1.0.6",
- "express": "2.4.3",
- "jade": "0.13",
- "oauth": "0.9.3",
- "redis": "0.6.6"
+ "connect-redis": "1.3.0",
+ "express": "2.5.9",
+ "jade": "0.25.0",
+ "oauth": "0.9.7",
+ "redis": "0.7.1"
+ },
+ "scripts": {
+ "start": "node app.js"
},
"devDependencies": {},
"main": "index",
View
@@ -207,6 +207,10 @@
resultContainer.append($(document.createElement('h4')).text('Call'));
resultContainer.append($(document.createElement('pre')).addClass('call'));
+ // Code
+ resultContainer.append($(document.createElement('h4')).text('Response Code'));
+ resultContainer.append($(document.createElement('pre')).addClass('code prettyprint'));
+
// Header
resultContainer.append($(document.createElement('h4')).text('Response Headers'));
resultContainer.append($(document.createElement('pre')).addClass('headers prettyprint'));
@@ -256,6 +260,11 @@
.text(response.call);
}
+ if (response.code) {
+ $('pre.code', resultContainer)
+ .text(response.code);
+ }
+
if (response.headers) {
$('pre.headers', resultContainer)
.text(formatJSON(response.headers));
@@ -285,7 +294,7 @@
$('pre.response', resultContainer)
.toggleClass('error', true)
.text(response);
- })
- })
+ });
+ });
})();
@@ -1,6 +1,6 @@
/*
- http://www.JSON.org/json2.js
- 2011-02-23
+ json2.js
+ 2011-10-19
Public Domain.
@@ -146,7 +146,7 @@
redistribute.
*/
-/*jslint evil: true, strict: false, regexp: false */
+/*jslint evil: true, regexp: true */
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
@@ -165,7 +165,7 @@ if (!JSON) {
}
(function () {
- "use strict";
+ 'use strict';
function f(n) {
// Format integers to have at least two digits.
@@ -176,13 +176,14 @@ if (!JSON) {
Date.prototype.toJSON = function (key) {
- return isFinite(this.valueOf()) ?
- this.getUTCFullYear() + '-' +
- f(this.getUTCMonth() + 1) + '-' +
- f(this.getUTCDate()) + 'T' +
- f(this.getUTCHours()) + ':' +
- f(this.getUTCMinutes()) + ':' +
- f(this.getUTCSeconds()) + 'Z' : null;
+ return isFinite(this.valueOf())
+ ? this.getUTCFullYear() + '-' +
+ f(this.getUTCMonth() + 1) + '-' +
+ f(this.getUTCDate()) + 'T' +
+ f(this.getUTCHours()) + ':' +
+ f(this.getUTCMinutes()) + ':' +
+ f(this.getUTCSeconds()) + 'Z'
+ : null;
};
String.prototype.toJSON =
@@ -218,8 +219,9 @@ if (!JSON) {
escapable.lastIndex = 0;
return escapable.test(string) ? '"' + string.replace(escapable, function (a) {
var c = meta[a];
- return typeof c === 'string' ? c :
- '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
+ return typeof c === 'string'
+ ? c
+ : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
}) + '"' : '"' + string + '"';
}
@@ -303,9 +305,11 @@ if (!JSON) {
// Join all of the elements together, separated with commas, and wrap them in
// brackets.
- v = partial.length === 0 ? '[]' : gap ?
- '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' :
- '[' + partial.join(',') + ']';
+ v = partial.length === 0
+ ? '[]'
+ : gap
+ ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
+ : '[' + partial.join(',') + ']';
gap = mind;
return v;
}
@@ -340,9 +344,11 @@ if (!JSON) {
// Join all of the member texts together, separated with commas,
// and wrap them in braces.
- v = partial.length === 0 ? '{}' : gap ?
- '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' :
- '{' + partial.join(',') + '}';
+ v = partial.length === 0
+ ? '{}'
+ : gap
+ ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
+ : '{' + partial.join(',') + '}';
gap = mind;
return v;
}
@@ -468,8 +474,9 @@ if (!JSON) {
// In the optional fourth stage, we recursively walk the new structure, passing
// each name/value pair to a reviver function for possible transformation.
- return typeof reviver === 'function' ?
- walk({'': j}, '') : j;
+ return typeof reviver === 'function'
+ ? walk({'': j}, '')
+ : j;
}
// If the text is not JSON parseable, then a SyntaxError is thrown.
View
@@ -12,11 +12,11 @@ html
body
!{body}
div(id='io-footer')
- div(class='f-left') ©
+ div(class='f-left') ©
a(href='http://mashery.com/io') Mashery, Inc.
- div(class='f-right') Powered by
+ div(class='f-right') Powered by
a(href='https://github.com/mashery/iodocs') I/O Docs
- script(src='https://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js')
+ script(src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js')
script(src='/javascripts/json2.js')
script(src='/javascripts/prettify.js')
script(src='/javascripts/utilities.js')