Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Moved sample app fully into sample

  • Loading branch information...
commit b00675d18034b7775a8938122bafa01d770cb4f3 1 parent 3474356
@dncrews dncrews authored
View
2  Procfile
@@ -1 +1 @@
-web: node-dev app.js
+web: node-dev sample/app.js
View
7 app.js → sample/app.js
@@ -1,13 +1,14 @@
/*global Buffer:false,clearInterval:false,clearTimeout:false,console:false,exports:false,global:false,module:false,process:false,querystring:false,require:false,setInterval:false,setTimeout:false,__filename:false,__dirname:false */
'use strict';
-var express = require('express');
+var express = require('express')
+ , path = require('path');
var app = express.createServer();
app.use(express.bodyParser());
-app.use(express.static(__dirname + '/assets'));
-app.use(express.static(__dirname + '/sample'));
+app.use(express.static(__dirname + '/public'));
+app.use(express.static(path.join(__dirname, '../assets')));
app.get('/sample/:type', function(req, res, next) {
console.log(req.headers);
View
2,018 sample/js/fs-superagent.js
@@ -1,2018 +0,0 @@
-;(function(){
-
-/**
- * Require the given path.
- *
- * @param {String} path
- * @return {Object} exports
- * @api public
- */
-
-function require(path, parent, orig) {
- var resolved = require.resolve(path);
-
- // lookup failed
- if (null == resolved) {
- orig = orig || path;
- parent = parent || 'root';
- var err = new Error('Failed to require "' + orig + '" from "' + parent + '"');
- err.path = orig;
- err.parent = parent;
- err.require = true;
- throw err;
- }
-
- var module = require.modules[resolved];
-
- // perform real require()
- // by invoking the module's
- // registered function
- if (!module._resolving && !module.exports) {
- var mod = {};
- mod.exports = {};
- mod.client = mod.component = true;
- module._resolving = true;
- module.call(this, mod.exports, require.relative(resolved), mod);
- delete module._resolving;
- module.exports = mod.exports;
- }
-
- return module.exports;
-}
-
-/**
- * Registered modules.
- */
-
-require.modules = {};
-
-/**
- * Registered aliases.
- */
-
-require.aliases = {};
-
-/**
- * Resolve `path`.
- *
- * Lookup:
- *
- * - PATH/index.js
- * - PATH.js
- * - PATH
- *
- * @param {String} path
- * @return {String} path or null
- * @api private
- */
-
-require.resolve = function(path) {
- if (path.charAt(0) === '/') path = path.slice(1);
-
- var paths = [
- path,
- path + '.js',
- path + '.json',
- path + '/index.js',
- path + '/index.json'
- ];
-
- for (var i = 0; i < paths.length; i++) {
- var path = paths[i];
- if (require.modules.hasOwnProperty(path)) return path;
- if (require.aliases.hasOwnProperty(path)) return require.aliases[path];
- }
-};
-
-/**
- * Normalize `path` relative to the current path.
- *
- * @param {String} curr
- * @param {String} path
- * @return {String}
- * @api private
- */
-
-require.normalize = function(curr, path) {
- var segs = [];
-
- if ('.' != path.charAt(0)) return path;
-
- curr = curr.split('/');
- path = path.split('/');
-
- for (var i = 0; i < path.length; ++i) {
- if ('..' == path[i]) {
- curr.pop();
- } else if ('.' != path[i] && '' != path[i]) {
- segs.push(path[i]);
- }
- }
-
- return curr.concat(segs).join('/');
-};
-
-/**
- * Register module at `path` with callback `definition`.
- *
- * @param {String} path
- * @param {Function} definition
- * @api private
- */
-
-require.register = function(path, definition) {
- require.modules[path] = definition;
-};
-
-/**
- * Alias a module definition.
- *
- * @param {String} from
- * @param {String} to
- * @api private
- */
-
-require.alias = function(from, to) {
- if (!require.modules.hasOwnProperty(from)) {
- throw new Error('Failed to alias "' + from + '", it does not exist');
- }
- require.aliases[to] = from;
-};
-
-/**
- * Return a require function relative to the `parent` path.
- *
- * @param {String} parent
- * @return {Function}
- * @api private
- */
-
-require.relative = function(parent) {
- var p = require.normalize(parent, '..');
-
- /**
- * lastIndexOf helper.
- */
-
- function lastIndexOf(arr, obj) {
- var i = arr.length;
- while (i--) {
- if (arr[i] === obj) return i;
- }
- return -1;
- }
-
- /**
- * The relative require() itself.
- */
-
- function localRequire(path) {
- var resolved = localRequire.resolve(path);
- return require(resolved, parent, path);
- }
-
- /**
- * Resolve relative to the parent.
- */
-
- localRequire.resolve = function(path) {
- var c = path.charAt(0);
- if ('/' == c) return path.slice(1);
- if ('.' == c) return require.normalize(p, path);
-
- // resolve deps by returning
- // the dep in the nearest "deps"
- // directory
- var segs = parent.split('/');
- var i = lastIndexOf(segs, 'deps') + 1;
- if (!i) i = 0;
- path = segs.slice(0, i + 1).join('/') + '/deps/' + path;
- return path;
- };
-
- /**
- * Check if module is defined at `path`.
- */
-
- localRequire.exists = function(path) {
- return require.modules.hasOwnProperty(localRequire.resolve(path));
- };
-
- return localRequire;
-};
-require.register("visionmedia-debug/index.js", Function("exports, require, module",
-"if ('undefined' == typeof window) {\n\
- module.exports = require('./lib/debug');\n\
-} else {\n\
- module.exports = require('./debug');\n\
-}\n\
-//@ sourceURL=visionmedia-debug/index.js"
-));
-require.register("visionmedia-debug/debug.js", Function("exports, require, module",
-"\n\
-/**\n\
- * Expose `debug()` as the module.\n\
- */\n\
-\n\
-module.exports = debug;\n\
-\n\
-/**\n\
- * Create a debugger with the given `name`.\n\
- *\n\
- * @param {String} name\n\
- * @return {Type}\n\
- * @api public\n\
- */\n\
-\n\
-function debug(name) {\n\
- if (!debug.enabled(name)) return function(){};\n\
-\n\
- return function(fmt){\n\
- fmt = coerce(fmt);\n\
-\n\
- var curr = new Date;\n\
- var ms = curr - (debug[name] || curr);\n\
- debug[name] = curr;\n\
-\n\
- fmt = name\n\
- + ' '\n\
- + fmt\n\
- + ' +' + debug.humanize(ms);\n\
-\n\
- // This hackery is required for IE8\n\
- // where `console.log` doesn't have 'apply'\n\
- window.console\n\
- && console.log\n\
- && Function.prototype.apply.call(console.log, console, arguments);\n\
- }\n\
-}\n\
-\n\
-/**\n\
- * The currently active debug mode names.\n\
- */\n\
-\n\
-debug.names = [];\n\
-debug.skips = [];\n\
-\n\
-/**\n\
- * Enables a debug mode by name. This can include modes\n\
- * separated by a colon and wildcards.\n\
- *\n\
- * @param {String} name\n\
- * @api public\n\
- */\n\
-\n\
-debug.enable = function(name) {\n\
- try {\n\
- localStorage.debug = name;\n\
- } catch(e){}\n\
-\n\
- var split = (name || '').split(/[\\s,]+/)\n\
- , len = split.length;\n\
-\n\
- for (var i = 0; i < len; i++) {\n\
- name = split[i].replace('*', '.*?');\n\
- if (name[0] === '-') {\n\
- debug.skips.push(new RegExp('^' + name.substr(1) + '$'));\n\
- }\n\
- else {\n\
- debug.names.push(new RegExp('^' + name + '$'));\n\
- }\n\
- }\n\
-};\n\
-\n\
-/**\n\
- * Disable debug output.\n\
- *\n\
- * @api public\n\
- */\n\
-\n\
-debug.disable = function(){\n\
- debug.enable('');\n\
-};\n\
-\n\
-/**\n\
- * Humanize the given `ms`.\n\
- *\n\
- * @param {Number} m\n\
- * @return {String}\n\
- * @api private\n\
- */\n\
-\n\
-debug.humanize = function(ms) {\n\
- var sec = 1000\n\
- , min = 60 * 1000\n\
- , hour = 60 * min;\n\
-\n\
- if (ms >= hour) return (ms / hour).toFixed(1) + 'h';\n\
- if (ms >= min) return (ms / min).toFixed(1) + 'm';\n\
- if (ms >= sec) return (ms / sec | 0) + 's';\n\
- return ms + 'ms';\n\
-};\n\
-\n\
-/**\n\
- * Returns true if the given mode name is enabled, false otherwise.\n\
- *\n\
- * @param {String} name\n\
- * @return {Boolean}\n\
- * @api public\n\
- */\n\
-\n\
-debug.enabled = function(name) {\n\
- for (var i = 0, len = debug.skips.length; i < len; i++) {\n\
- if (debug.skips[i].test(name)) {\n\
- return false;\n\
- }\n\
- }\n\
- for (var i = 0, len = debug.names.length; i < len; i++) {\n\
- if (debug.names[i].test(name)) {\n\
- return true;\n\
- }\n\
- }\n\
- return false;\n\
-};\n\
-\n\
-/**\n\
- * Coerce `val`.\n\
- */\n\
-\n\
-function coerce(val) {\n\
- if (val instanceof Error) return val.stack || val.message;\n\
- return val;\n\
-}\n\
-\n\
-// persist\n\
-\n\
-try {\n\
- if (window.localStorage) debug.enable(localStorage.debug);\n\
-} catch(e){}\n\
-//@ sourceURL=visionmedia-debug/debug.js"
-));
-require.register("component-url/index.js", Function("exports, require, module",
-"\n\
-/**\n\
- * Parse the given `url`.\n\
- *\n\
- * @param {String} str\n\
- * @return {Object}\n\
- * @api public\n\
- */\n\
-\n\
-exports.parse = function(url){\n\
- var a = document.createElement('a');\n\
- a.href = url;\n\
- return {\n\
- href: a.href,\n\
- host: a.host || location.host,\n\
- port: ('0' === a.port || '' === a.port) ? location.port : a.port,\n\
- hash: a.hash,\n\
- hostname: a.hostname || location.hostname,\n\
- pathname: a.pathname.charAt(0) != '/' ? '/' + a.pathname : a.pathname,\n\
- protocol: !a.protocol || ':' == a.protocol ? location.protocol : a.protocol,\n\
- search: a.search,\n\
- query: a.search.slice(1)\n\
- };\n\
-};\n\
-\n\
-/**\n\
- * Check if `url` is absolute.\n\
- *\n\
- * @param {String} url\n\
- * @return {Boolean}\n\
- * @api public\n\
- */\n\
-\n\
-exports.isAbsolute = function(url){\n\
- return 0 == url.indexOf('//') || !!~url.indexOf('://');\n\
-};\n\
-\n\
-/**\n\
- * Check if `url` is relative.\n\
- *\n\
- * @param {String} url\n\
- * @return {Boolean}\n\
- * @api public\n\
- */\n\
-\n\
-exports.isRelative = function(url){\n\
- return !exports.isAbsolute(url);\n\
-};\n\
-\n\
-/**\n\
- * Check if `url` is cross domain.\n\
- *\n\
- * @param {String} url\n\
- * @return {Boolean}\n\
- * @api public\n\
- */\n\
-\n\
-exports.isCrossDomain = function(url){\n\
- url = exports.parse(url);\n\
- return url.hostname !== location.hostname\n\
- || url.port !== location.port\n\
- || url.protocol !== location.protocol;\n\
-};//@ sourceURL=component-url/index.js"
-));
-require.register("RedVentures-reduce/index.js", Function("exports, require, module",
-"\n\
-/**\n\
- * Reduce `arr` with `fn`.\n\
- *\n\
- * @param {Array} arr\n\
- * @param {Function} fn\n\
- * @param {Mixed} initial\n\
- *\n\
- * TODO: combatible error handling?\n\
- */\n\
-\n\
-module.exports = function(arr, fn, initial){ \n\
- var idx = 0;\n\
- var len = arr.length;\n\
- var curr = arguments.length == 3\n\
- ? initial\n\
- : arr[idx++];\n\
-\n\
- while (idx < len) {\n\
- curr = fn.call(null, curr, arr[idx], ++idx, arr);\n\
- }\n\
- \n\
- return curr;\n\
-};//@ sourceURL=RedVentures-reduce/index.js"
-));
-require.register("visionmedia-superagent/lib/client.js", Function("exports, require, module",
-"/**\n\
- * Module dependencies.\n\
- */\n\
-\n\
-var Emitter = require('emitter');\n\
-var reduce = require('reduce');\n\
-\n\
-/**\n\
- * Root reference for iframes.\n\
- */\n\
-\n\
-var root = 'undefined' == typeof window\n\
- ? this\n\
- : window;\n\
-\n\
-/**\n\
- * Noop.\n\
- */\n\
-\n\
-function noop(){};\n\
-\n\
-/**\n\
- * Check if `obj` is a host object,\n\
- * we don't want to serialize these :)\n\
- *\n\
- * TODO: future proof, move to compoent land\n\
- *\n\
- * @param {Object} obj\n\
- * @return {Boolean}\n\
- * @api private\n\
- */\n\
-\n\
-function isHost(obj) {\n\
- var str = {}.toString.call(obj);\n\
-\n\
- switch (str) {\n\
- case '[object File]':\n\
- case '[object Blob]':\n\
- case '[object FormData]':\n\
- return true;\n\
- default:\n\
- return false;\n\
- }\n\
-}\n\
-\n\
-/**\n\
- * Determine XHR.\n\
- */\n\
-\n\
-function getXHR() {\n\
- if (root.XMLHttpRequest\n\
- && ('file:' != root.location.protocol || !root.ActiveXObject)) {\n\
- return new XMLHttpRequest;\n\
- } else {\n\
- try { return new ActiveXObject('Microsoft.XMLHTTP'); } catch(e) {}\n\
- try { return new ActiveXObject('Msxml2.XMLHTTP.6.0'); } catch(e) {}\n\
- try { return new ActiveXObject('Msxml2.XMLHTTP.3.0'); } catch(e) {}\n\
- try { return new ActiveXObject('Msxml2.XMLHTTP'); } catch(e) {}\n\
- }\n\
- return false;\n\
-}\n\
-\n\
-/**\n\
- * Removes leading and trailing whitespace, added to support IE.\n\
- *\n\
- * @param {String} s\n\
- * @return {String}\n\
- * @api private\n\
- */\n\
-\n\
-var trim = ''.trim\n\
- ? function(s) { return s.trim(); }\n\
- : function(s) { return s.replace(/(^\\s*|\\s*$)/g, ''); };\n\
-\n\
-/**\n\
- * Check if `obj` is an object.\n\
- *\n\
- * @param {Object} obj\n\
- * @return {Boolean}\n\
- * @api private\n\
- */\n\
-\n\
-function isObject(obj) {\n\
- return obj === Object(obj);\n\
-}\n\
-\n\
-/**\n\
- * Serialize the given `obj`.\n\
- *\n\
- * @param {Object} obj\n\
- * @return {String}\n\
- * @api private\n\
- */\n\
-\n\
-function serialize(obj) {\n\
- if (!isObject(obj)) return obj;\n\
- var pairs = [];\n\
- for (var key in obj) {\n\
- pairs.push(encodeURIComponent(key)\n\
- + '=' + encodeURIComponent(obj[key]));\n\
- }\n\
- return pairs.join('&');\n\
-}\n\
-\n\
-/**\n\
- * Expose serialization method.\n\
- */\n\
-\n\
- request.serializeObject = serialize;\n\
-\n\
- /**\n\
- * Parse the given x-www-form-urlencoded `str`.\n\
- *\n\
- * @param {String} str\n\
- * @return {Object}\n\
- * @api private\n\
- */\n\
-\n\
-function parseString(str) {\n\
- var obj = {};\n\
- var pairs = str.split('&');\n\
- var parts;\n\
- var pair;\n\
-\n\
- for (var i = 0, len = pairs.length; i < len; ++i) {\n\
- pair = pairs[i];\n\
- parts = pair.split('=');\n\
- obj[decodeURIComponent(parts[0])] = decodeURIComponent(parts[1]);\n\
- }\n\
-\n\
- return obj;\n\
-}\n\
-\n\
-/**\n\
- * Expose parser.\n\
- */\n\
-\n\
-request.parseString = parseString;\n\
-\n\
-/**\n\
- * Default MIME type map.\n\
- *\n\
- * superagent.types.xml = 'application/xml';\n\
- *\n\
- */\n\
-\n\
-request.types = {\n\
- html: 'text/html',\n\
- json: 'application/json',\n\
- urlencoded: 'application/x-www-form-urlencoded',\n\
- 'form': 'application/x-www-form-urlencoded',\n\
- 'form-data': 'application/x-www-form-urlencoded'\n\
-};\n\
-\n\
-/**\n\
- * Default serialization map.\n\
- *\n\
- * superagent.serialize['application/xml'] = function(obj){\n\
- * return 'generated xml here';\n\
- * };\n\
- *\n\
- */\n\
-\n\
- request.serialize = {\n\
- 'application/x-www-form-urlencoded': serialize,\n\
- 'application/json': JSON.stringify\n\
- };\n\
-\n\
- /**\n\
- * Default parsers.\n\
- *\n\
- * superagent.parse['application/xml'] = function(str){\n\
- * return { object parsed from str };\n\
- * };\n\
- *\n\
- */\n\
-\n\
-request.parse = {\n\
- 'application/x-www-form-urlencoded': parseString,\n\
- 'application/json': JSON.parse\n\
-};\n\
-\n\
-/**\n\
- * Parse the given header `str` into\n\
- * an object containing the mapped fields.\n\
- *\n\
- * @param {String} str\n\
- * @return {Object}\n\
- * @api private\n\
- */\n\
-\n\
-function parseHeader(str) {\n\
- var lines = str.split(/\\r?\\n\
-/);\n\
- var fields = {};\n\
- var index;\n\
- var line;\n\
- var field;\n\
- var val;\n\
-\n\
- lines.pop(); // trailing CRLF\n\
-\n\
- for (var i = 0, len = lines.length; i < len; ++i) {\n\
- line = lines[i];\n\
- index = line.indexOf(':');\n\
- field = line.slice(0, index).toLowerCase();\n\
- val = trim(line.slice(index + 1));\n\
- fields[field] = val;\n\
- }\n\
-\n\
- return fields;\n\
-}\n\
-\n\
-/**\n\
- * Return the mime type for the given `str`.\n\
- *\n\
- * @param {String} str\n\
- * @return {String}\n\
- * @api private\n\
- */\n\
-\n\
-function type(str){\n\
- return str.split(/ *; */).shift();\n\
-};\n\
-\n\
-/**\n\
- * Return header field parameters.\n\
- *\n\
- * @param {String} str\n\
- * @return {Object}\n\
- * @api private\n\
- */\n\
-\n\
-function params(str){\n\
- return reduce(str.split(/ *; */), function(obj, str){\n\
- var parts = str.split(/ *= */)\n\
- , key = parts.shift()\n\
- , val = parts.shift();\n\
-\n\
- if (key && val) obj[key] = val;\n\
- return obj;\n\
- }, {});\n\
-};\n\
-\n\
-/**\n\
- * Initialize a new `Response` with the given `xhr`.\n\
- *\n\
- * - set flags (.ok, .error, etc)\n\
- * - parse header\n\
- *\n\
- * Examples:\n\
- *\n\
- * Aliasing `superagent` as `request` is nice:\n\
- *\n\
- * request = superagent;\n\
- *\n\
- * We can use the promise-like API, or pass callbacks:\n\
- *\n\
- * request.get('/').end(function(res){});\n\
- * request.get('/', function(res){});\n\
- *\n\
- * Sending data can be chained:\n\
- *\n\
- * request\n\
- * .post('/user')\n\
- * .send({ name: 'tj' })\n\
- * .end(function(res){});\n\
- *\n\
- * Or passed to `.send()`:\n\
- *\n\
- * request\n\
- * .post('/user')\n\
- * .send({ name: 'tj' }, function(res){});\n\
- *\n\
- * Or passed to `.post()`:\n\
- *\n\
- * request\n\
- * .post('/user', { name: 'tj' })\n\
- * .end(function(res){});\n\
- *\n\
- * Or further reduced to a single call for simple cases:\n\
- *\n\
- * request\n\
- * .post('/user', { name: 'tj' }, function(res){});\n\
- *\n\
- * @param {XMLHTTPRequest} xhr\n\
- * @param {Object} options\n\
- * @api private\n\
- */\n\
-\n\
-function Response(req, options) {\n\
- options = options || {};\n\
- this.req = req;\n\
- this.xhr = this.req.xhr;\n\
- this.text = this.xhr.responseText;\n\
- this.setStatusProperties(this.xhr.status);\n\
- this.header = this.headers = parseHeader(this.xhr.getAllResponseHeaders());\n\
- // getAllResponseHeaders sometimes falsely returns \"\" for CORS requests, but\n\
- // getResponseHeader still works. so we get content-type even if getting\n\
- // other headers fails.\n\
- this.header['content-type'] = this.xhr.getResponseHeader('content-type');\n\
- this.setHeaderProperties(this.header);\n\
- this.body = this.parseBody(this.text);\n\
-}\n\
-\n\
-/**\n\
- * Get case-insensitive `field` value.\n\
- *\n\
- * @param {String} field\n\
- * @return {String}\n\
- * @api public\n\
- */\n\
-\n\
-Response.prototype.get = function(field){\n\
- return this.header[field.toLowerCase()];\n\
-};\n\
-\n\
-/**\n\
- * Set header related properties:\n\
- *\n\
- * - `.type` the content type without params\n\
- *\n\
- * A response of \"Content-Type: text/plain; charset=utf-8\"\n\
- * will provide you with a `.type` of \"text/plain\".\n\
- *\n\
- * @param {Object} header\n\
- * @api private\n\
- */\n\
-\n\
-Response.prototype.setHeaderProperties = function(header){\n\
- // content-type\n\
- var ct = this.header['content-type'] || '';\n\
- this.type = type(ct);\n\
-\n\
- // params\n\
- var obj = params(ct);\n\
- for (var key in obj) this[key] = obj[key];\n\
-};\n\
-\n\
-/**\n\
- * Parse the given body `str`.\n\
- *\n\
- * Used for auto-parsing of bodies. Parsers\n\
- * are defined on the `superagent.parse` object.\n\
- *\n\
- * @param {String} str\n\
- * @return {Mixed}\n\
- * @api private\n\
- */\n\
-\n\
-Response.prototype.parseBody = function(str){\n\
- var parse = request.parse[this.type];\n\
- return parse\n\
- ? parse(str)\n\
- : null;\n\
-};\n\
-\n\
-/**\n\
- * Set flags such as `.ok` based on `status`.\n\
- *\n\
- * For example a 2xx response will give you a `.ok` of __true__\n\
- * whereas 5xx will be __false__ and `.error` will be __true__. The\n\
- * `.clientError` and `.serverError` are also available to be more\n\
- * specific, and `.statusType` is the class of error ranging from 1..5\n\
- * sometimes useful for mapping respond colors etc.\n\
- *\n\
- * \"sugar\" properties are also defined for common cases. Currently providing:\n\
- *\n\
- * - .noContent\n\
- * - .badRequest\n\
- * - .unauthorized\n\
- * - .notAcceptable\n\
- * - .notFound\n\
- *\n\
- * @param {Number} status\n\
- * @api private\n\
- */\n\
-\n\
-Response.prototype.setStatusProperties = function(status){\n\
- var type = status / 100 | 0;\n\
-\n\
- // status / class\n\
- this.status = status;\n\
- this.statusType = type;\n\
-\n\
- // basics\n\
- this.info = 1 == type;\n\
- this.ok = 2 == type;\n\
- this.clientError = 4 == type;\n\
- this.serverError = 5 == type;\n\
- this.error = (4 == type || 5 == type)\n\
- ? this.toError()\n\
- : false;\n\
-\n\
- // sugar\n\
- this.accepted = 202 == status;\n\
- this.noContent = 204 == status || 1223 == status;\n\
- this.badRequest = 400 == status;\n\
- this.unauthorized = 401 == status;\n\
- this.notAcceptable = 406 == status;\n\
- this.notFound = 404 == status;\n\
- this.forbidden = 403 == status;\n\
-};\n\
-\n\
-/**\n\
- * Return an `Error` representative of this response.\n\
- *\n\
- * @return {Error}\n\
- * @api public\n\
- */\n\
-\n\
-Response.prototype.toError = function(){\n\
- var req = this.req;\n\
- var method = req.method;\n\
- var path = req.path;\n\
-\n\
- var msg = 'cannot ' + method + ' ' + path + ' (' + this.status + ')';\n\
- var err = new Error(msg);\n\
- err.status = this.status;\n\
- err.method = method;\n\
- err.path = path;\n\
-\n\
- return err;\n\
-};\n\
-\n\
-/**\n\
- * Expose `Response`.\n\
- */\n\
-\n\
-request.Response = Response;\n\
-\n\
-/**\n\
- * Initialize a new `Request` with the given `method` and `url`.\n\
- *\n\
- * @param {String} method\n\
- * @param {String} url\n\
- * @api public\n\
- */\n\
-\n\
-function Request(method, url) {\n\
- var self = this;\n\
- Emitter.call(this);\n\
- this._query = this._query || [];\n\
- this.method = method;\n\
- this.url = url;\n\
- this.header = {};\n\
- this._header = {};\n\
- this.on('end', function(){\n\
- var res = new Response(self);\n\
- if ('HEAD' == method) res.text = null;\n\
- self.callback(null, res);\n\
- });\n\
-}\n\
-\n\
-/**\n\
- * Mixin `Emitter`.\n\
- */\n\
-\n\
-Emitter(Request.prototype);\n\
-\n\
-/**\n\
- * Set timeout to `ms`.\n\
- *\n\
- * @param {Number} ms\n\
- * @return {Request} for chaining\n\
- * @api public\n\
- */\n\
-\n\
-Request.prototype.timeout = function(ms){\n\
- this._timeout = ms;\n\
- return this;\n\
-};\n\
-\n\
-/**\n\
- * Clear previous timeout.\n\
- *\n\
- * @return {Request} for chaining\n\
- * @api public\n\
- */\n\
-\n\
-Request.prototype.clearTimeout = function(){\n\
- this._timeout = 0;\n\
- clearTimeout(this._timer);\n\
- return this;\n\
-};\n\
-\n\
-/**\n\
- * Abort the request, and clear potential timeout.\n\
- *\n\
- * @return {Request}\n\
- * @api public\n\
- */\n\
-\n\
-Request.prototype.abort = function(){\n\
- if (this.aborted) return;\n\
- this.aborted = true;\n\
- this.xhr.abort();\n\
- this.clearTimeout();\n\
- this.emit('abort');\n\
- return this;\n\
-};\n\
-\n\
-/**\n\
- * Set header `field` to `val`, or multiple fields with one object.\n\
- *\n\
- * Examples:\n\
- *\n\
- * req.get('/')\n\
- * .set('Accept', 'application/json')\n\
- * .set('X-API-Key', 'foobar')\n\
- * .end(callback);\n\
- *\n\
- * req.get('/')\n\
- * .set({ Accept: 'application/json', 'X-API-Key': 'foobar' })\n\
- * .end(callback);\n\
- *\n\
- * @param {String|Object} field\n\
- * @param {String} val\n\
- * @return {Request} for chaining\n\
- * @api public\n\
- */\n\
-\n\
-Request.prototype.set = function(field, val){\n\
- if (isObject(field)) {\n\
- for (var key in field) {\n\
- this.set(key, field[key]);\n\
- }\n\
- return this;\n\
- }\n\
- this._header[field.toLowerCase()] = val;\n\
- this.header[field] = val;\n\
- return this;\n\
-};\n\
-\n\
-/**\n\
- * Get case-insensitive header `field` value.\n\
- *\n\
- * @param {String} field\n\
- * @return {String}\n\
- * @api private\n\
- */\n\
-\n\
-Request.prototype.getHeader = function(field){\n\
- return this._header[field.toLowerCase()];\n\
-};\n\
-\n\
-/**\n\
- * Set Content-Type to `type`, mapping values from `request.types`.\n\
- *\n\
- * Examples:\n\
- *\n\
- * superagent.types.xml = 'application/xml';\n\
- *\n\
- * request.post('/')\n\
- * .type('xml')\n\
- * .send(xmlstring)\n\
- * .end(callback);\n\
- *\n\
- * request.post('/')\n\
- * .type('application/xml')\n\
- * .send(xmlstring)\n\
- * .end(callback);\n\
- *\n\
- * @param {String} type\n\
- * @return {Request} for chaining\n\
- * @api public\n\
- */\n\
-\n\
-Request.prototype.type = function(type){\n\
- this.set('Content-Type', request.types[type] || type);\n\
- return this;\n\
-};\n\
-\n\
-/**\n\
- * Set Authorization field value with `user` and `pass`.\n\
- *\n\
- * @param {String} user\n\
- * @param {String} pass\n\
- * @return {Request} for chaining\n\
- * @api public\n\
- */\n\
-\n\
-Request.prototype.auth = function(user, pass){\n\
- var str = btoa(user + ':' + pass);\n\
- this.set('Authorization', 'Basic ' + str);\n\
- return this;\n\
-};\n\
-\n\
-/**\n\
-* Add query-string `val`.\n\
-*\n\
-* Examples:\n\
-*\n\
-* request.get('/shoes')\n\
-* .query('size=10')\n\
-* .query({ color: 'blue' })\n\
-*\n\
-* @param {Object|String} val\n\
-* @return {Request} for chaining\n\
-* @api public\n\
-*/\n\
-\n\
-Request.prototype.query = function(val){\n\
- if ('string' != typeof val) val = serialize(val);\n\
- if (val) this._query.push(val);\n\
- return this;\n\
-};\n\
-\n\
-/**\n\
- * Send `data`, defaulting the `.type()` to \"json\" when\n\
- * an object is given.\n\
- *\n\
- * Examples:\n\
- *\n\
- * // querystring\n\
- * request.get('/search')\n\
- * .end(callback)\n\
- *\n\
- * // multiple data \"writes\"\n\
- * request.get('/search')\n\
- * .send({ search: 'query' })\n\
- * .send({ range: '1..5' })\n\
- * .send({ order: 'desc' })\n\
- * .end(callback)\n\
- *\n\
- * // manual json\n\
- * request.post('/user')\n\
- * .type('json')\n\
- * .send('{\"name\":\"tj\"})\n\
- * .end(callback)\n\
- *\n\
- * // auto json\n\
- * request.post('/user')\n\
- * .send({ name: 'tj' })\n\
- * .end(callback)\n\
- *\n\
- * // manual x-www-form-urlencoded\n\
- * request.post('/user')\n\
- * .type('form')\n\
- * .send('name=tj')\n\
- * .end(callback)\n\
- *\n\
- * // auto x-www-form-urlencoded\n\
- * request.post('/user')\n\
- * .type('form')\n\
- * .send({ name: 'tj' })\n\
- * .end(callback)\n\
- *\n\
- * // defaults to x-www-form-urlencoded\n\
- * request.post('/user')\n\
- * .send('name=tobi')\n\
- * .send('species=ferret')\n\
- * .end(callback)\n\
- *\n\
- * @param {String|Object} data\n\
- * @return {Request} for chaining\n\
- * @api public\n\
- */\n\
-\n\
-Request.prototype.send = function(data){\n\
- var obj = isObject(data);\n\
- var type = this.getHeader('Content-Type');\n\
-\n\
- // merge\n\
- if (obj && isObject(this._data)) {\n\
- for (var key in data) {\n\
- this._data[key] = data[key];\n\
- }\n\
- } else if ('string' == typeof data) {\n\
- if (!type) this.type('form');\n\
- type = this.getHeader('Content-Type');\n\
- if ('application/x-www-form-urlencoded' == type) {\n\
- this._data = this._data\n\
- ? this._data + '&' + data\n\
- : data;\n\
- } else {\n\
- this._data = (this._data || '') + data;\n\
- }\n\
- } else {\n\
- this._data = data;\n\
- }\n\
-\n\
- if (!obj) return this;\n\
- if (!type) this.type('json');\n\
- return this;\n\
-};\n\
-\n\
-/**\n\
- * Invoke the callback with `err` and `res`\n\
- * and handle arity check.\n\
- *\n\
- * @param {Error} err\n\
- * @param {Response} res\n\
- * @api private\n\
- */\n\
-\n\
-Request.prototype.callback = function(err, res){\n\
- var fn = this._callback;\n\
- if (2 == fn.length) return fn(err, res);\n\
- if (err) return this.emit('error', err);\n\
- fn(res);\n\
-};\n\
-\n\
-/**\n\
- * Invoke callback with x-domain error.\n\
- *\n\
- * @api private\n\
- */\n\
-\n\
-Request.prototype.crossDomainError = function(){\n\
- var err = new Error('Origin is not allowed by Access-Control-Allow-Origin');\n\
- err.crossDomain = true;\n\
- this.callback(err);\n\
-};\n\
-\n\
-/**\n\
- * Invoke callback with timeout error.\n\
- *\n\
- * @api private\n\
- */\n\
-\n\
-Request.prototype.timeoutError = function(){\n\
- var timeout = this._timeout;\n\
- var err = new Error('timeout of ' + timeout + 'ms exceeded');\n\
- err.timeout = timeout;\n\
- this.callback(err);\n\
-};\n\
-\n\
-/**\n\
- * Enable transmission of cookies with x-domain requests.\n\
- *\n\
- * Note that for this to work the origin must not be\n\
- * using \"Access-Control-Allow-Origin\" with a wildcard,\n\
- * and also must set \"Access-Control-Allow-Credentials\"\n\
- * to \"true\".\n\
- *\n\
- * @api public\n\
- */\n\
-\n\
-Request.prototype.withCredentials = function(){\n\
- this._withCredentials = true;\n\
- return this;\n\
-};\n\
-\n\
-/**\n\
- * Initiate request, invoking callback `fn(res)`\n\
- * with an instanceof `Response`.\n\
- *\n\
- * @param {Function} fn\n\
- * @return {Request} for chaining\n\
- * @api public\n\
- */\n\
-\n\
-Request.prototype.end = function(fn){\n\
- var self = this;\n\
- var xhr = this.xhr = getXHR();\n\
- var query = this._query.join('&');\n\
- var timeout = this._timeout;\n\
- var data = this._data;\n\
-\n\
- // store callback\n\
- this._callback = fn || noop;\n\
-\n\
- // CORS\n\
- if (this._withCredentials) xhr.withCredentials = true;\n\
-\n\
- // state change\n\
- xhr.onreadystatechange = function(){\n\
- if (4 != xhr.readyState) return;\n\
- if (0 == xhr.status) {\n\
- if (self.aborted) return self.timeoutError();\n\
- return self.crossDomainError();\n\
- }\n\
- self.emit('end');\n\
- };\n\
-\n\
- // progress\n\
- if (xhr.upload) {\n\
- xhr.upload.onprogress = function(e){\n\
- e.percent = e.loaded / e.total * 100;\n\
- self.emit('progress', e);\n\
- };\n\
- }\n\
-\n\
- // timeout\n\
- if (timeout && !this._timer) {\n\
- this._timer = setTimeout(function(){\n\
- self.abort();\n\
- }, timeout);\n\
- }\n\
-\n\
- // querystring\n\
- if (query) {\n\
- query = request.serializeObject(query);\n\
- this.url += ~this.url.indexOf('?')\n\
- ? '&' + query\n\
- : '?' + query;\n\
- }\n\
-\n\
- // initiate request\n\
- xhr.open(this.method, this.url, true);\n\
-\n\
- // body\n\
- if ('GET' != this.method && 'HEAD' != this.method && 'string' != typeof data && !isHost(data)) {\n\
- // serialize stuff\n\
- var serialize = request.serialize[this.getHeader('Content-Type')];\n\
- if (serialize) data = serialize(data);\n\
- }\n\
-\n\
- // set header fields\n\
- for (var field in this.header) {\n\
- if (null == this.header[field]) continue;\n\
- xhr.setRequestHeader(field, this.header[field]);\n\
- }\n\
-\n\
- // send stuff\n\
- xhr.send(data);\n\
- return this;\n\
-};\n\
-\n\
-/**\n\
- * Expose `Request`.\n\
- */\n\
-\n\
-request.Request = Request;\n\
-\n\
-/**\n\
- * Issue a request:\n\
- *\n\
- * Examples:\n\
- *\n\
- * request('GET', '/users').end(callback)\n\
- * request('/users').end(callback)\n\
- * request('/users', callback)\n\
- *\n\
- * @param {String} method\n\
- * @param {String|Function} url or callback\n\
- * @return {Request}\n\
- * @api public\n\
- */\n\
-\n\
-function request(method, url) {\n\
- // callback\n\
- if ('function' == typeof url) {\n\
- return new Request('GET', method).end(url);\n\
- }\n\
-\n\
- // url first\n\
- if (1 == arguments.length) {\n\
- return new Request('GET', method);\n\
- }\n\
-\n\
- return new Request(method, url);\n\
-}\n\
-\n\
-/**\n\
- * GET `url` with optional callback `fn(res)`.\n\
- *\n\
- * @param {String} url\n\
- * @param {Mixed|Function} data or fn\n\
- * @param {Function} fn\n\
- * @return {Request}\n\
- * @api public\n\
- */\n\
-\n\
-request.get = function(url, data, fn){\n\
- var req = request('GET', url);\n\
- if ('function' == typeof data) fn = data, data = null;\n\
- if (data) req.query(data);\n\
- if (fn) req.end(fn);\n\
- return req;\n\
-};\n\
-\n\
-/**\n\
- * GET `url` with optional callback `fn(res)`.\n\
- *\n\
- * @param {String} url\n\
- * @param {Mixed|Function} data or fn\n\
- * @param {Function} fn\n\
- * @return {Request}\n\
- * @api public\n\
- */\n\
-\n\
-request.head = function(url, data, fn){\n\
- var req = request('HEAD', url);\n\
- if ('function' == typeof data) fn = data, data = null;\n\
- if (data) req.send(data);\n\
- if (fn) req.end(fn);\n\
- return req;\n\
-};\n\
-\n\
-/**\n\
- * DELETE `url` with optional callback `fn(res)`.\n\
- *\n\
- * @param {String} url\n\
- * @param {Function} fn\n\
- * @return {Request}\n\
- * @api public\n\
- */\n\
-\n\
-request.del = function(url, fn){\n\
- var req = request('DELETE', url);\n\
- if (fn) req.end(fn);\n\
- return req;\n\
-};\n\
-\n\
-/**\n\
- * PATCH `url` with optional `data` and callback `fn(res)`.\n\
- *\n\
- * @param {String} url\n\
- * @param {Mixed} data\n\
- * @param {Function} fn\n\
- * @return {Request}\n\
- * @api public\n\
- */\n\
-\n\
-request.patch = function(url, data, fn){\n\
- var req = request('PATCH', url);\n\
- if ('function' == typeof data) fn = data, data = null;\n\
- if (data) req.send(data);\n\
- if (fn) req.end(fn);\n\
- return req;\n\
-};\n\
-\n\
-/**\n\
- * POST `url` with optional `data` and callback `fn(res)`.\n\
- *\n\
- * @param {String} url\n\
- * @param {Mixed} data\n\
- * @param {Function} fn\n\
- * @return {Request}\n\
- * @api public\n\
- */\n\
-\n\
-request.post = function(url, data, fn){\n\
- var req = request('POST', url);\n\
- if ('function' == typeof data) fn = data, data = null;\n\
- if (data) req.send(data);\n\
- if (fn) req.end(fn);\n\
- return req;\n\
-};\n\
-\n\
-/**\n\
- * PUT `url` with optional `data` and callback `fn(res)`.\n\
- *\n\
- * @param {String} url\n\
- * @param {Mixed|Function} data or fn\n\
- * @param {Function} fn\n\
- * @return {Request}\n\
- * @api public\n\
- */\n\
-\n\
-request.put = function(url, data, fn){\n\
- var req = request('PUT', url);\n\
- if ('function' == typeof data) fn = data, data = null;\n\
- if (data) req.send(data);\n\
- if (fn) req.end(fn);\n\
- return req;\n\
-};\n\
-\n\
-/**\n\
- * Expose `request`.\n\
- */\n\
-\n\
-module.exports = request;\n\
-//@ sourceURL=visionmedia-superagent/lib/client.js"
-));
-require.register("component-indexof/index.js", Function("exports, require, module",
-"module.exports = function(arr, obj){\n\
- if (arr.indexOf) return arr.indexOf(obj);\n\
- for (var i = 0; i < arr.length; ++i) {\n\
- if (arr[i] === obj) return i;\n\
- }\n\
- return -1;\n\
-};//@ sourceURL=component-indexof/index.js"
-));
-require.register("component-emitter/index.js", Function("exports, require, module",
-"\n\
-/**\n\
- * Module dependencies.\n\
- */\n\
-\n\
-var index = require('indexof');\n\
-\n\
-/**\n\
- * Expose `Emitter`.\n\
- */\n\
-\n\
-module.exports = Emitter;\n\
-\n\
-/**\n\
- * Initialize a new `Emitter`.\n\
- *\n\
- * @api public\n\
- */\n\
-\n\
-function Emitter(obj) {\n\
- if (obj) return mixin(obj);\n\
-};\n\
-\n\
-/**\n\
- * Mixin the emitter properties.\n\
- *\n\
- * @param {Object} obj\n\
- * @return {Object}\n\
- * @api private\n\
- */\n\
-\n\
-function mixin(obj) {\n\
- for (var key in Emitter.prototype) {\n\
- obj[key] = Emitter.prototype[key];\n\
- }\n\
- return obj;\n\
-}\n\
-\n\
-/**\n\
- * Listen on the given `event` with `fn`.\n\
- *\n\
- * @param {String} event\n\
- * @param {Function} fn\n\
- * @return {Emitter}\n\
- * @api public\n\
- */\n\
-\n\
-Emitter.prototype.on =\n\
-Emitter.prototype.addEventListener = function(event, fn){\n\
- this._callbacks = this._callbacks || {};\n\
- (this._callbacks[event] = this._callbacks[event] || [])\n\
- .push(fn);\n\
- return this;\n\
-};\n\
-\n\
-/**\n\
- * Adds an `event` listener that will be invoked a single\n\
- * time then automatically removed.\n\
- *\n\
- * @param {String} event\n\
- * @param {Function} fn\n\
- * @return {Emitter}\n\
- * @api public\n\
- */\n\
-\n\
-Emitter.prototype.once = function(event, fn){\n\
- var self = this;\n\
- this._callbacks = this._callbacks || {};\n\
-\n\
- function on() {\n\
- self.off(event, on);\n\
- fn.apply(this, arguments);\n\
- }\n\
-\n\
- fn._off = on;\n\
- this.on(event, on);\n\
- return this;\n\
-};\n\
-\n\
-/**\n\
- * Remove the given callback for `event` or all\n\
- * registered callbacks.\n\
- *\n\
- * @param {String} event\n\
- * @param {Function} fn\n\
- * @return {Emitter}\n\
- * @api public\n\
- */\n\
-\n\
-Emitter.prototype.off =\n\
-Emitter.prototype.removeListener =\n\
-Emitter.prototype.removeAllListeners =\n\
-Emitter.prototype.removeEventListener = function(event, fn){\n\
- this._callbacks = this._callbacks || {};\n\
-\n\
- // all\n\
- if (0 == arguments.length) {\n\
- this._callbacks = {};\n\
- return this;\n\
- }\n\
-\n\
- // specific event\n\
- var callbacks = this._callbacks[event];\n\
- if (!callbacks) return this;\n\
-\n\
- // remove all handlers\n\
- if (1 == arguments.length) {\n\
- delete this._callbacks[event];\n\
- return this;\n\
- }\n\
-\n\
- // remove specific handler\n\
- var i = index(callbacks, fn._off || fn);\n\
- if (~i) callbacks.splice(i, 1);\n\
- return this;\n\
-};\n\
-\n\
-/**\n\
- * Emit `event` with the given args.\n\
- *\n\
- * @param {String} event\n\
- * @param {Mixed} ...\n\
- * @return {Emitter}\n\
- */\n\
-\n\
-Emitter.prototype.emit = function(event){\n\
- this._callbacks = this._callbacks || {};\n\
- var args = [].slice.call(arguments, 1)\n\
- , callbacks = this._callbacks[event];\n\
-\n\
- if (callbacks) {\n\
- callbacks = callbacks.slice(0);\n\
- for (var i = 0, len = callbacks.length; i < len; ++i) {\n\
- callbacks[i].apply(this, args);\n\
- }\n\
- }\n\
-\n\
- return this;\n\
-};\n\
-\n\
-/**\n\
- * Return array of callbacks for `event`.\n\
- *\n\
- * @param {String} event\n\
- * @return {Array}\n\
- * @api public\n\
- */\n\
-\n\
-Emitter.prototype.listeners = function(event){\n\
- this._callbacks = this._callbacks || {};\n\
- return this._callbacks[event] || [];\n\
-};\n\
-\n\
-/**\n\
- * Check if this emitter has `event` handlers.\n\
- *\n\
- * @param {String} event\n\
- * @return {Boolean}\n\
- * @api public\n\
- */\n\
-\n\
-Emitter.prototype.hasListeners = function(event){\n\
- return !! this.listeners(event).length;\n\
-};\n\
-//@ sourceURL=component-emitter/index.js"
-));
-require.register("CamShaft-require-component/index.js", Function("exports, require, module",
-"/**\n\
- * Require a module with a fallback\n\
- */\n\
-module.exports = function(parent) {\n\
- function require(name, fallback) {\n\
- try {\n\
- return parent(name);\n\
- }\n\
- catch (e) {\n\
- try {\n\
- return parent(fallback || name+\"-component\");\n\
- }\n\
- catch(e2) {\n\
- throw e;\n\
- }\n\
- }\n\
- };\n\
-\n\
- // Merge the old properties\n\
- for (var key in parent) {\n\
- require[key] = parent[key];\n\
- }\n\
-\n\
- return require;\n\
-};\n\
-//@ sourceURL=CamShaft-require-component/index.js"
-));
-require.register("CamShaft-superagent-defaults/index.js", Function("exports, require, module",
-"/**\n\
- * Module dependencies.\n\
- */\n\
-\n\
-require = require('require-component')(require);\n\
-\n\
-var request = require('superagent')\n\
- , Emitter = require('emitter')\n\
- , methods = require('methods', './methods');\n\
- \n\
-/**\n\
- * Expose `Context`.\n\
- */\n\
- \n\
-module.exports = Context;\n\
- \n\
-/**\n\
- * Initialize a new `Context`.\n\
- *\n\
- * @api public\n\
- */\n\
- \n\
-function Context() {\n\
- if (!(this instanceof Context)) return new Context;\n\
- this.headers = [];\n\
-}\n\
- \n\
-/**\n\
- * Inherit from `Emitter`\n\
- */\n\
- \n\
-Emitter(Context.prototype);\n\
- \n\
-/**\n\
- * Add a default header to the context\n\
- * \n\
- * @api public\n\
- */\n\
- \n\
-Context.prototype.set = function() {\n\
- this.headers.push(arguments);\n\
- return this;\n\
-}\n\
- \n\
-/**\n\
- * Set the default headers on the req\n\
- * \n\
- * @api private\n\
- */\n\
- \n\
-Context.prototype.applyHeaders = function(req) {\n\
- each(this.headers, function(header) {\n\
- req.set.apply(req, header);\n\
- });\n\
-}\n\
- \n\
-// generate HTTP verb methods\n\
- \n\
-each(methods, function(method){\n\
- var name = 'delete' == method ? 'del' : method;\n\
- \n\
- method = method.toUpperCase();\n\
- Context.prototype[name] = function(url, fn){\n\
- var req = request(method, url);\n\
- \n\
- // Do the attaching here\n\
- this.applyHeaders(req);\n\
- \n\
- // Tell the listeners we've created a new request\n\
- this.emit('request', req);\n\
- \n\
- fn && req.end(fn);\n\
- return req;\n\
- };\n\
-});\n\
-\n\
-/**\n\
- * Iterate array-ish.\n\
- *\n\
- * @param {Array|Object} arr\n\
- * @param {Function} fn\n\
- * @api private\n\
- */\n\
-\n\
-function each(arr, fn) {\n\
- for (var i = 0; i < arr.length; ++i) {\n\
- fn(arr[i], i);\n\
- }\n\
-}\n\
-//@ sourceURL=CamShaft-superagent-defaults/index.js"
-));
-require.register("CamShaft-superagent-defaults/methods.js", Function("exports, require, module",
-"module.exports = [\n\
- 'get',\n\
- 'post',\n\
- 'put',\n\
- 'head',\n\
- 'delete',\n\
- 'options',\n\
- 'trace',\n\
- 'patch'\n\
-];//@ sourceURL=CamShaft-superagent-defaults/methods.js"
-));
-require.register("fs-superagent/lib/client/helpers/readCookies.js", Function("exports, require, module",
-"/*global console:false,module:false,require:false,document:false,window:false,XMLHttpRequest:false */\n\
-'use strict';\n\
-\n\
-var cookies;\n\
-\n\
-module.exports = function readCookies() {\n\
- if (cookies) return cookies;\n\
- var c, C, i;\n\
-\n\
- c = document.cookie.split('; ');\n\
- cookies = {};\n\
-\n\
- for(i=c.length-1; i>=0; i--){\n\
- C = c[i].split('=');\n\
- cookies[C[0]] = C[1];\n\
- }\n\
-\n\
- return cookies;\n\
-};\n\
-//@ sourceURL=fs-superagent/lib/client/helpers/readCookies.js"
-));
-require.register("fs-superagent/lib/client/helpers/readHeaders.js", Function("exports, require, module",
-"// I'm not sure this does what I wanted it to do.\n\
-// These things are handled elsewhere (HAProxy, accept-language, etc)\n\
-\n\
-\n\
-/*global console:false,module:false,require:false,document:false,window:false,XMLHttpRequest:false */\n\
-'use strict';\n\
-\n\
-var headers;\n\
-\n\
-module.exports = function readHeaders() {\n\
- if (headers) return headers;\n\
- var req;\n\
- req = new XMLHttpRequest();\n\
- req.open('GET', document.location, false);\n\
- req.send(null);\n\
- headers = req.getAllResponseHeaders().toLowerCase();\n\
- return headers;\n\
-};\n\
-//@ sourceURL=fs-superagent/lib/client/helpers/readHeaders.js"
-));
-require.register("fs-superagent/lib/fs-superagent.js", Function("exports, require, module",
-"/**\n\
- * Create a superagent context from the supplied cookies and headers\n\
- * Applies some defaults like:\n\
- *\n\
- * - response time metrics (Future)\n\
- * - send the x-request-id header\n\
- * - send the authorization if the user is logged in\n\
- *\n\
- * Also provides some additional opt-ins:\n\
- * - Setting locale\n\
- * - Setting sessionId to query\n\
- * - Error handling (Future)\n\
- * - Timeout handling (Future)\n\
- *\n\
- * Example\n\
- *\n\
- * app.get('/', function(req, res) {\n\
- * req.superagent\n\
- * .get('http://example.com')\n\
- * .end(function(err, res) {\n\
- * // The request has the default headers applied\n\
- * // do app work here\n\
- * })\n\
- * });\n\
- */\n\
-\n\
-/*global Buffer:false,clearInterval:false,clearTimeout:false,console:false,exports:false,global:false,module:false,process:false,querystring:false,require:false,setInterval:false,setTimeout:false,__filename:false,__dirname:false */\n\
-'use strict';\n\
-\n\
-var superagent = require('superagent-defaults')\n\
- , debug = require('debug')('fs-superagent:core')\n\
- , url = require('url');\n\
-\n\
-module.exports = fsSuperagent;\n\
-\n\
-function fsSuperagent(config, addlRequestHandler) {\n\
- var user = config.user || {}\n\
- , cookies = config.cookies || {}\n\
- , headers = config.headers || {};\n\
-\n\
- return superagent().on('request', function(request) {\n\
- var reqId = headers['x-request-id']\n\
- , sessId = user.sessionId || cookies.fssessionid\n\
- , info = url.parse(request.url)\n\
- , addToLogs = {}\n\
- , endHandler;\n\
-\n\
- // TODO: Add centralized metric logging (BEGIN);\n\
-\n\
- request.set('accept', 'application/json');\n\
-\n\
- // Do we want a default timeout on the client?\n\
- // request.timeout(20000);\n\
-\n\
- if (reqId) request.set('x-request-id', reqId);\n\
- if (sessId) request.set('authorization', 'Bearer ' + sessId);\n\
-\n\
- request.setLocale = function(locale) {\n\
- locale = (locale || headers['accept-language'] || 'en').substr(0,2);\n\
- request.query({ 'locale' : locale });\n\
- return request;\n\
- };\n\
-\n\
- request.setSessionId = function(sessionName) {\n\
- var query = {};\n\
-\n\
- query[sessionName] = sessId;\n\
- request.query(query);\n\
- return request;\n\
- };\n\
-\n\
- request.addErrorHandler = function(handler) {\n\
- request.on('error', handler);\n\
- return request;\n\
- };\n\
-\n\
- request.addLog = function(name, value) {\n\
- if (typeof name === 'string' && typeof value === 'string') {\n\
- addToLogs[name] = value;\n\
- }\n\
- if (typeof name === 'object') {\n\
- for (var key in name) {\n\
- if (name.hasOwnProperty(key)) {\n\
- addToLogs[key] = name[key];\n\
- }\n\
- }\n\
- }\n\
- return request;\n\
- };\n\
-\n\
- request.handleEnd = function(handler) {\n\
- if (typeof handler === 'function') {\n\
- endHandler = handler;\n\
- }\n\
- };\n\
-\n\
- if (addlRequestHandler) {\n\
- addlRequestHandler(request);\n\
- }\n\
-\n\
-\n\
- // We have to overwrite the request.end to fix the error handling problems\n\
- request._end = request.end;\n\
- request.end = function(cb) {\n\
-\n\
- function doCb() {\n\
- if(typeof endHandler === 'function') {\n\
- return endHandler(cb, arguments);\n\
- }\n\
- cb.apply(null, arguments);\n\
- }\n\
-\n\
- // Default to no error callback\n\
- var okCB = function(response) {\n\
- doCb(response);\n\
- };\n\
- if (cb.length === 2) {\n\
- // 200 callback requires empty first param\n\
- okCB = function(response) {\n\
- doCb(null, response);\n\
- };\n\
- // Bind the error callback for errors\n\
- request.addErrorHandler(doCb);\n\
- }\n\
-\n\
- request._end(function(response) {\n\
- // TODO: Add centralized metric logging (FINISHED);\n\
- okCB(response);\n\
- });\n\
- };\n\
- });\n\
-}\n\
-//@ sourceURL=fs-superagent/lib/fs-superagent.js"
-));
-require.register("fs-superagent/lib/client/ng-fs-superagent.js", Function("exports, require, module",
-"/*global console:false,module:false,require:false,document:false,window:false,XMLHttpRequest:false */\n\
-'use strict';\n\
-\n\
-var fsSuperagent = require('../fs-superagent')\n\
- , readCookies = require('./helpers/readCookies');\n\
- // , readHeaders = require('./helpers/readHeaders');\n\
-\n\
-module.exports = function(app) {\n\
-\n\
- /**\n\
- * Optional $superagent init directive\n\
- */\n\
- app.directive('superagentInit', [\n\
- '$superagent',\n\
-\n\
- function($superagent) {\n\
- return {\n\
- restrict: 'EA',\n\
- link: function(scope) {\n\
- $superagent.on('request', function(request) {\n\
- request.handleEnd(function(cb, params) {\n\
- scope.$apply(function() {\n\
- cb.apply(null, params);\n\
- });\n\
- });\n\
- });\n\
- }\n\
- };\n\
- }\n\
- ]);\n\
-\n\
- /**\n\
- * $superagent \"Service\"\n\
- */\n\
- app.factory('$superagent', [\n\
-\n\
- function() {\n\
- return fsSuperagent({\n\
- // headers: readHeaders(),\n\
- cookies: readCookies()\n\
- })\n\
- .on('request', function(request) {\n\
- request.$setScope = function(scope) {\n\
- request.handleEnd(function(cb, params) {\n\
- scope.$apply(function() {\n\
- cb.apply(null, params);\n\
- });\n\
- });\n\
- return request;\n\
- };\n\
- });\n\
- }\n\
- ]);\n\
-};\n\
-//@ sourceURL=fs-superagent/lib/client/ng-fs-superagent.js"
-));
-require.register("fs-superagent/lib/client/obj-fs-superagent.js", Function("exports, require, module",
-"/*global console:false,module:false,require:false,document:false,window:false,XMLHttpRequest:false */\n\
-'use strict';\n\
-\n\
-var fsSuperagent = require('../fs-superagent')\n\
- , readCookies = require('./helpers/readCookies');\n\
- // , readHeaders = require('./helpers/readHeaders');\n\
-\n\
-module.exports = function() {\n\
- return fsSuperagent({\n\
- // headers: readHeaders(),\n\
- cookies: readCookies()\n\
- });\n\
-};\n\
-//@ sourceURL=fs-superagent/lib/client/obj-fs-superagent.js"
-));
-require.register("fs-superagent/lib/client/index.js", Function("exports, require, module",
-"/*global console:false,module:false,require:false,document:false,window:false,XMLHttpRequest:false */\n\
-'use strict';\n\
-\n\
-module.exports = {\n\
- 'angular' : require('./ng-fs-superagent'),\n\
- 'obj' : require('./obj-fs-superagent')\n\
-};\n\
-//@ sourceURL=fs-superagent/lib/client/index.js"
-));
-
-
-
-
-
-
-
-
-
-
-require.alias("visionmedia-debug/index.js", "fs-superagent/deps/debug/index.js");
-require.alias("visionmedia-debug/debug.js", "fs-superagent/deps/debug/debug.js");
-require.alias("visionmedia-debug/index.js", "debug/index.js");
-
-require.alias("component-url/index.js", "fs-superagent/deps/url/index.js");
-require.alias("component-url/index.js", "url/index.js");
-
-require.alias("CamShaft-superagent-defaults/index.js", "fs-superagent/deps/superagent-defaults/index.js");
-require.alias("CamShaft-superagent-defaults/methods.js", "fs-superagent/deps/superagent-defaults/methods.js");
-require.alias("CamShaft-superagent-defaults/index.js", "superagent-defaults/index.js");
-require.alias("visionmedia-superagent/lib/client.js", "CamShaft-superagent-defaults/deps/superagent/lib/client.js");
-require.alias("visionmedia-superagent/lib/client.js", "CamShaft-superagent-defaults/deps/superagent/index.js");
-require.alias("component-emitter/index.js", "visionmedia-superagent/deps/emitter/index.js");
-require.alias("component-indexof/index.js", "component-emitter/deps/indexof/index.js");
-
-require.alias("RedVentures-reduce/index.js", "visionmedia-superagent/deps/reduce/index.js");
-
-require.alias("visionmedia-superagent/lib/client.js", "visionmedia-superagent/index.js");
-require.alias("component-emitter/index.js", "CamShaft-superagent-defaults/deps/emitter/index.js");
-require.alias("component-indexof/index.js", "component-emitter/deps/indexof/index.js");
-
-require.alias("CamShaft-require-component/index.js", "CamShaft-superagent-defaults/deps/require-component/index.js");
-
-require.alias("fs-superagent/lib/client/index.js", "fs-superagent/index.js");if (typeof exports == "object") {
- module.exports = require("fs-superagent");
-} else if (typeof define == "function" && define.amd) {
- define(function(){ return require("fs-superagent"); });
-} else {
- this["fsSuperagent"] = require("fs-superagent");
-}})();
View
0  sample/index.html → sample/public/index.html
File renamed without changes
View
0  sample/js/my_app.js → sample/public/js/my_app.js
File renamed without changes
View
0  ...le/vendor/bootstrap-3.0.0/css/bootstrap-theme.css → ...ic/vendor/bootstrap-3.0.0/css/bootstrap-theme.css
File renamed without changes
View
0  ...endor/bootstrap-3.0.0/css/bootstrap-theme.min.css → ...endor/bootstrap-3.0.0/css/bootstrap-theme.min.css
File renamed without changes
View
0  sample/vendor/bootstrap-3.0.0/css/bootstrap.css → ...e/public/vendor/bootstrap-3.0.0/css/bootstrap.css
File renamed without changes
View
0  sample/vendor/bootstrap-3.0.0/css/bootstrap.min.css → ...blic/vendor/bootstrap-3.0.0/css/bootstrap.min.css
File renamed without changes
View
0  ...trap-3.0.0/fonts/glyphicons-halflings-regular.eot → ...trap-3.0.0/fonts/glyphicons-halflings-regular.eot
File renamed without changes
View
0  ...trap-3.0.0/fonts/glyphicons-halflings-regular.svg → ...trap-3.0.0/fonts/glyphicons-halflings-regular.svg
File renamed without changes
View
0  ...trap-3.0.0/fonts/glyphicons-halflings-regular.ttf → ...trap-3.0.0/fonts/glyphicons-halflings-regular.ttf
File renamed without changes
View
0  ...rap-3.0.0/fonts/glyphicons-halflings-regular.woff → ...rap-3.0.0/fonts/glyphicons-halflings-regular.woff
File renamed without changes
View
0  sample/vendor/bootstrap-3.0.0/js/bootstrap.js → sample/public/vendor/bootstrap-3.0.0/js/bootstrap.js
File renamed without changes
View
0  sample/vendor/bootstrap-3.0.0/js/bootstrap.min.js → ...public/vendor/bootstrap-3.0.0/js/bootstrap.min.js
File renamed without changes
Please sign in to comment.
Something went wrong with that request. Please try again.