浏览代码

Upgrade to swagger 2.2

Laurent Destailleur 4 年之前
父节点
当前提交
5d0e93344b
共有 57 个文件被更改,包括 1258 次插入11005 次删除
  1. 1 1
      COPYRIGHT
  2. 7 3
      dev/dolibarr_changes.txt
  3. 6 1
      htdocs/api/class/api_login.class.php
  4. 5 0
      htdocs/api/index.php
  5. 0 1187
      htdocs/includes/restler/framework/Luracast/Restler/explorer/css/print.css
  6. 1 125
      htdocs/includes/restler/framework/Luracast/Restler/explorer/css/reset.css
  7. 0 1304
      htdocs/includes/restler/framework/Luracast/Restler/explorer/css/screen.css
  8. 0 250
      htdocs/includes/restler/framework/Luracast/Restler/explorer/css/style.css
  9. 0 14
      htdocs/includes/restler/framework/Luracast/Restler/explorer/css/typography.css
  10. 二进制
      htdocs/includes/restler/framework/Luracast/Restler/explorer/fonts/DroidSans-Bold.ttf
  11. 二进制
      htdocs/includes/restler/framework/Luracast/Restler/explorer/fonts/DroidSans.ttf
  12. 二进制
      htdocs/includes/restler/framework/Luracast/Restler/explorer/images/explorer_icons.png
  13. 二进制
      htdocs/includes/restler/framework/Luracast/Restler/explorer/images/favicon-16x16.png
  14. 二进制
      htdocs/includes/restler/framework/Luracast/Restler/explorer/images/favicon-32x32.png
  15. 二进制
      htdocs/includes/restler/framework/Luracast/Restler/explorer/images/favicon.ico
  16. 二进制
      htdocs/includes/restler/framework/Luracast/Restler/explorer/images/logo_small.png
  17. 二进制
      htdocs/includes/restler/framework/Luracast/Restler/explorer/images/pet_store_api.png
  18. 二进制
      htdocs/includes/restler/framework/Luracast/Restler/explorer/images/wordnik_api.png
  19. 27 25
      htdocs/includes/restler/framework/Luracast/Restler/explorer/index.html
  20. 53 0
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lang/ca.js
  21. 56 0
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lang/el.js
  22. 1 0
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lang/en.js
  23. 1 0
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lang/es.js
  24. 2 1
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lang/fr.js
  25. 56 0
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lang/geo.js
  26. 6 3
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lang/ja.js
  27. 53 0
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lang/ko-kr.js
  28. 1 0
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lang/ru.js
  29. 1 1
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lang/translator.js
  30. 3 0
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lang/zh-cn.js
  31. 0 2
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/backbone-min.js
  32. 0 0
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/es5-shim.js
  33. 0 302
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/handlebars-1.0.0.js
  34. 0 26
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/handlebars-2.0.0.js
  35. 0 0
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/handlebars-4.0.5.js
  36. 0 0
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/highlight.7.3.pack.js
  37. 0 0
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/highlight.9.1.0.pack.js
  38. 1 0
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/highlight.9.1.0.pack_extended.js
  39. 0 1
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/jquery-1.8.0.min.js
  40. 0 8
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/jquery.ba-bbq.min.js
  41. 1 1
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/jquery.slideto.min.js
  42. 1 8
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/jquery.wiggle.min.js
  43. 0 0
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/js-yaml.min.js
  44. 0 6
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/jsoneditor.min.js
  45. 0 0
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/lodash.min.js
  46. 0 1272
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/marked.js
  47. 1 0
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/object-assign-pollyfill.js
  48. 0 0
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/sanitize-html.min.js
  49. 0 2765
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/shred.bundle.js
  50. 0 193
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/shred/content.js
  51. 0 338
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/swagger-oauth.js
  52. 0 1653
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/swagger.js
  53. 0 4
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/underscore-min.js
  54. 0 0
      htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/underscore-min.map
  55. 3 3
      htdocs/includes/restler/framework/Luracast/Restler/explorer/o2c.html
  56. 971 1508
      htdocs/includes/restler/framework/Luracast/Restler/explorer/swagger-ui.js
  57. 0 0
      htdocs/includes/restler/framework/Luracast/Restler/explorer/swagger-ui.min.js

+ 1 - 1
COPYRIGHT

@@ -54,7 +54,7 @@ jQuery TableDnD        0.6           GPL and MIT License         Yes
 jQuery Timepicker      1.1.0         GPL and MIT License         Yes             JS library Timepicker addon for Datepicker
 jsGanttImproved        2.7.3         BSD License                 Yes             JS library (to build Gantt reports)
 JsTimezoneDetect       1.0.6         MIT License                 Yes             JS library to detect user timezone
-SwaggerUI			   2.0.24		 GPL-2+                      Yes             JS library to offer the REST API explorer
+SwaggerUI			   2.2.10		 GPL-2+                      Yes             JS library to offer the REST API explorer
 
 Image libraries:
 Octicons               8.1           MIT                         Yes

+ 7 - 3
dev/dolibarr_changes.txt

@@ -225,9 +225,6 @@ JQUERYFILETREE:
 
 RESTLER:
 --------
-Change content of file htdocs/includes/restler/framework/Luracast/Restler/explorer/index.html
-
-+With swagger 2:
 
 * Add line into Util.php to complete function
 
@@ -249,6 +246,13 @@ Change content of file htdocs/includes/restler/framework/Luracast/Restler/explor
         if (!is_string($haystack)) return false;
 
 
++With swagger 2 provided into /explorer:
+----------------------------------------
+
+Change content of file htdocs/includes/restler/framework/Luracast/Restler/explorer/index.html
+
+
+
 PARSEDOWN
 ---------
 

+ 6 - 1
htdocs/api/class/api_login.class.php

@@ -31,8 +31,13 @@ class Login
 	 */
 	public function __construct()
 	{
-		global $db;
+		global $conf, $db;
 		$this->db = $db;
+
+		//$conf->global->MAIN_MODULE_API_LOGIN_DISABLED = 1;
+		if (!empty($conf->global->MAIN_MODULE_API_LOGIN_DISABLED)) {
+			throw new RestException(403, "Error login APIs are disabled. You must get the token from backoffice to be able to use APIs");
+		}
 	}
 
 	/**

+ 5 - 0
htdocs/api/index.php

@@ -218,6 +218,11 @@ if (!empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $
 									continue;
 								}
 
+								//$conf->global->MAIN_MODULE_API_LOGIN_DISABLED = 1;
+								if ($file_searched == 'api_login.class.php' && !empty($conf->global->MAIN_MODULE_API_LOGIN_DISABLED)) {
+									continue;
+								}
+
 								$regapi = array();
 								if (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i", $file_searched, $regapi)) {
 									$classname = ucwords($regapi[1]);

文件差异内容过多而无法显示
+ 0 - 1187
htdocs/includes/restler/framework/Luracast/Restler/explorer/css/print.css


+ 1 - 125
htdocs/includes/restler/framework/Luracast/Restler/explorer/css/reset.css

@@ -1,125 +1 @@
-/* http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 */
-html,
-body,
-div,
-span,
-applet,
-object,
-iframe,
-h1,
-h2,
-h3,
-h4,
-h5,
-h6,
-p,
-blockquote,
-pre,
-a,
-abbr,
-acronym,
-address,
-big,
-cite,
-code,
-del,
-dfn,
-em,
-img,
-ins,
-kbd,
-q,
-s,
-samp,
-small,
-strike,
-strong,
-sub,
-sup,
-tt,
-var,
-b,
-u,
-i,
-center,
-dl,
-dt,
-dd,
-ol,
-ul,
-li,
-fieldset,
-form,
-label,
-legend,
-table,
-caption,
-tbody,
-tfoot,
-thead,
-tr,
-th,
-td,
-article,
-aside,
-canvas,
-details,
-embed,
-figure,
-figcaption,
-footer,
-header,
-hgroup,
-menu,
-nav,
-output,
-ruby,
-section,
-summary,
-time,
-mark,
-audio,
-video {
-  margin: 0;
-  padding: 0;
-  border: 0;
-  font-size: 100%;
-  font: inherit;
-  vertical-align: baseline;
-}
-/* HTML5 display-role reset for older browsers */
-article,
-aside,
-details,
-figcaption,
-figure,
-footer,
-header,
-hgroup,
-menu,
-nav,
-section {
-  display: block;
-}
-body {
-  line-height: 1;
-}
-ol,
-ul {
-  list-style: none;
-}
-blockquote,
-q {
-  quotes: none;
-}
-blockquote:before,
-blockquote:after,
-q:before,
-q:after {
-  content: '';
-  content: none;
-}
-table {
-  border-collapse: collapse;
-  border-spacing: 0;
-}
+a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:'';content:none}table{border-collapse:collapse;border-spacing:0}

文件差异内容过多而无法显示
+ 0 - 1304
htdocs/includes/restler/framework/Luracast/Restler/explorer/css/screen.css


文件差异内容过多而无法显示
+ 0 - 250
htdocs/includes/restler/framework/Luracast/Restler/explorer/css/style.css


+ 0 - 14
htdocs/includes/restler/framework/Luracast/Restler/explorer/css/typography.css

@@ -1,14 +0,0 @@
-/* Google Font's Droid Sans */
-@font-face {
-  font-family: 'Droid Sans';
-  font-style: normal;
-  font-weight: 400;
-  src: local('Droid Sans'), local('DroidSans'), url('../fonts/DroidSans.ttf') format('truetype');
-}
-/* Google Font's Droid Sans Bold */
-@font-face {
-  font-family: 'Droid Sans';
-  font-style: normal;
-  font-weight: 700;
-  src: local('Droid Sans Bold'), local('DroidSans-Bold'), url('../fonts/DroidSans-Bold.ttf') format('truetype');
-}

二进制
htdocs/includes/restler/framework/Luracast/Restler/explorer/fonts/DroidSans-Bold.ttf


二进制
htdocs/includes/restler/framework/Luracast/Restler/explorer/fonts/DroidSans.ttf


二进制
htdocs/includes/restler/framework/Luracast/Restler/explorer/images/explorer_icons.png


二进制
htdocs/includes/restler/framework/Luracast/Restler/explorer/images/favicon-16x16.png


二进制
htdocs/includes/restler/framework/Luracast/Restler/explorer/images/favicon-32x32.png


二进制
htdocs/includes/restler/framework/Luracast/Restler/explorer/images/favicon.ico


二进制
htdocs/includes/restler/framework/Luracast/Restler/explorer/images/logo_small.png


二进制
htdocs/includes/restler/framework/Luracast/Restler/explorer/images/pet_store_api.png


二进制
htdocs/includes/restler/framework/Luracast/Restler/explorer/images/wordnik_api.png


+ 27 - 25
htdocs/includes/restler/framework/Luracast/Restler/explorer/index.html

@@ -1,24 +1,28 @@
-
 <!DOCTYPE html>
 <html>
 <head>
   <meta charset="UTF-8">
-  <title>REST API Explorer</title>
+  <meta http-equiv="x-ua-compatible" content="IE=edge">
+  <title>Swagger UI</title>
+  <link rel="icon" type="image/png" href="images/favicon-32x32.png" sizes="32x32" />
+  <link rel="icon" type="image/png" href="images/favicon-16x16.png" sizes="16x16" />
   <link href='css/typography.css' media='screen' rel='stylesheet' type='text/css'/>
   <link href='css/reset.css' media='screen' rel='stylesheet' type='text/css'/>
   <link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/>
   <link href='css/reset.css' media='print' rel='stylesheet' type='text/css'/>
   <link href='css/print.css' media='print' rel='stylesheet' type='text/css'/>
-  <!-- @CHANGE LDR Remove external links <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet"> -->
+
+  <script src='lib/object-assign-pollyfill.js' type='text/javascript'></script>
   <script src='lib/jquery-1.8.0.min.js' type='text/javascript'></script>
   <script src='lib/jquery.slideto.min.js' type='text/javascript'></script>
   <script src='lib/jquery.wiggle.min.js' type='text/javascript'></script>
   <script src='lib/jquery.ba-bbq.min.js' type='text/javascript'></script>
-  <script src='lib/handlebars-2.0.0.js' type='text/javascript'></script>
-  <script src='lib/underscore-min.js' type='text/javascript'></script>
+  <script src='lib/handlebars-4.0.5.js' type='text/javascript'></script>
+  <script src='lib/lodash.min.js' type='text/javascript'></script>
   <script src='lib/backbone-min.js' type='text/javascript'></script>
   <script src='swagger-ui.js' type='text/javascript'></script>
-  <script src='lib/highlight.7.3.pack.js' type='text/javascript'></script>
+  <script src='lib/highlight.9.1.0.pack.js' type='text/javascript'></script>
+  <script src='lib/highlight.9.1.0.pack_extended.js' type='text/javascript'></script>
   <script src='lib/jsoneditor.min.js' type='text/javascript'></script>
   <script src='lib/marked.js' type='text/javascript'></script>
   <script src='lib/swagger-oauth.js' type='text/javascript'></script>
@@ -37,6 +41,10 @@
         url = "swagger.json";
       }
 
+      hljs.configure({
+        highlightSizeThreshold: 5000
+      });
+
       // Pre load translate...
       if(window.SwaggerTranslator) {
         window.SwaggerTranslator.translate();
@@ -51,8 +59,8 @@
               clientId: "your-client-id",
               clientSecret: "your-client-secret-if-required",
               realm: "your-realms",
-              appName: "your-app-name", 
-              scopeSeparator: ",",
+              appName: "your-app-name",
+              scopeSeparator: " ",
               additionalQueryStringParams: {}
             });
           }
@@ -60,11 +68,7 @@
           if(window.SwaggerTranslator) {
             window.SwaggerTranslator.translate();
           }
-
-          $('pre code').each(function(i, e) {
-            hljs.highlightBlock(e)
-          });
-
+          
           addApiKeyAuthorization();
         },
         onFailure: function(data) {
@@ -74,8 +78,12 @@
         jsonEditor: false,
         apisSorter: "alpha",
         operationsSorter: "alpha",
-        defaultModelRendering: 'schema',
-        showRequestHeaders: false
+        defaultModelRendering: 'model',		/* example or model or schema */
+        defaultModelsExpandDepth: -1,
+        showRequestHeaders: false,
+        showOperationIds: false,
+        displayOperationIds: false,
+        displayRequestDuration: true
       });
 
       function addApiKeyAuthorization(){
@@ -100,13 +108,7 @@
       }
 
       $('#input_apiKey').change(addApiKeyAuthorization);
-
-      // if you have an apiKey you would like to pre-populate on the page for demonstration purposes...
-      /*
-        var apiKey = "myApiKeyXXXX123456789";
-        $('#input_apiKey').val(apiKey);
-      */
-
+      
       window.swaggerUi.load();
 
       function log() {
@@ -118,14 +120,14 @@
   </script>
   
   <style>
-	.info_title, .info_description, .info_contact, .info_name, .info_url, .info_email, .info_license {
-		display: none;
+	.info_title, .info_description, .info_contact, .info_name, .info_url, .info_email, .info_license, #api_info, #input_baseUrl {
+		display: none !important;
 	}
   </style>  
 </head>
 
 <body class="swagger-section">
-<div id='header'>
+<div id="header" style="background-color: rgb(38,60,92); height: 17px;">
   <div class="swagger-ui-wrap">
     <a id="logo" href="#">Dolibarr REST API Explorer</a>
     <form id='api_selector'>

+ 53 - 0
htdocs/includes/restler/framework/Luracast/Restler/explorer/lang/ca.js

@@ -0,0 +1,53 @@
+'use strict';
+
+/* jshint quotmark: double */
+window.SwaggerTranslator.learn({
+    "Warning: Deprecated":"Advertència: Obsolet",
+    "Implementation Notes":"Notes d'implementació",
+    "Response Class":"Classe de la Resposta",
+    "Status":"Estatus",
+    "Parameters":"Paràmetres",
+    "Parameter":"Paràmetre",
+    "Value":"Valor",
+    "Description":"Descripció",
+    "Parameter Type":"Tipus del Paràmetre",
+    "Data Type":"Tipus de la Dada",
+    "Response Messages":"Missatges de la Resposta",
+    "HTTP Status Code":"Codi d'Estatus HTTP",
+    "Reason":"Raó",
+    "Response Model":"Model de la Resposta",
+    "Request URL":"URL de la Sol·licitud",
+    "Response Body":"Cos de la Resposta",
+    "Response Code":"Codi de la Resposta",
+    "Response Headers":"Capçaleres de la Resposta",
+    "Hide Response":"Amagar Resposta",
+    "Try it out!":"Prova-ho!",
+    "Show/Hide":"Mostrar/Amagar",
+    "List Operations":"Llista Operacions",
+    "Expand Operations":"Expandir Operacions",
+    "Raw":"Cru",
+    "can't parse JSON.  Raw result":"no puc analitzar el JSON.  Resultat cru",
+    "Example Value":"Valor d'Exemple",
+    "Model Schema":"Esquema del Model",
+    "Model":"Model",
+    "apply":"aplicar",
+    "Username":"Nom d'usuari",
+    "Password":"Contrasenya",
+    "Terms of service":"Termes del servei",
+    "Created by":"Creat per",
+    "See more at":"Veure més en",
+    "Contact the developer":"Contactar amb el desenvolupador",
+    "api version":"versió de la api",
+    "Response Content Type":"Tipus de Contingut de la Resposta",
+    "fetching resource":"recollint recurs",
+    "fetching resource list":"recollins llista de recursos",
+    "Explore":"Explorant",
+    "Show Swagger Petstore Example Apis":"Mostrar API d'Exemple Swagger Petstore",
+    "Can't read from server.  It may not have the appropriate access-control-origin settings.":"No es pot llegir del servidor. Potser no teniu la configuració de control d'accés apropiada.",
+    "Please specify the protocol for":"Si us plau, especifiqueu el protocol per a",
+    "Can't read swagger JSON from":"No es pot llegir el JSON de swagger des de",
+    "Finished Loading Resource Information. Rendering Swagger UI":"Finalitzada la càrrega del recurs informatiu. Renderitzant Swagger UI",
+    "Unable to read api":"No es pot llegir l'api",
+    "from path":"des de la ruta",
+    "server returned":"el servidor ha retornat"
+});

+ 56 - 0
htdocs/includes/restler/framework/Luracast/Restler/explorer/lang/el.js

@@ -0,0 +1,56 @@
+'use strict';
+
+/* jshint quotmark: double */
+window.SwaggerTranslator.learn({
+    "Warning: Deprecated":"Προειδοποίηση: Έχει αποσυρθεί",
+    "Implementation Notes":"Σημειώσεις Υλοποίησης",
+    "Response Class":"Απόκριση",
+    "Status":"Κατάσταση",
+    "Parameters":"Παράμετροι",
+    "Parameter":"Παράμετρος",
+    "Value":"Τιμή",
+    "Description":"Περιγραφή",
+    "Parameter Type":"Τύπος Παραμέτρου",
+    "Data Type":"Τύπος Δεδομένων",
+    "Response Messages":"Μηνύματα Απόκρισης",
+    "HTTP Status Code":"Κωδικός Κατάστασης HTTP",
+    "Reason":"Αιτιολογία",
+    "Response Model":"Μοντέλο Απόκρισης",
+    "Request URL":"URL Αιτήματος",
+    "Response Body":"Σώμα Απόκρισης",
+    "Response Code":"Κωδικός Απόκρισης",
+    "Response Headers":"Επικεφαλίδες Απόκρισης",
+    "Hide Response":"Απόκρυψη Απόκρισης",
+    "Headers":"Επικεφαλίδες",
+    "Try it out!":"Δοκιμάστε το!",
+    "Show/Hide":"Εμφάνιση/Απόκρυψη",
+    "List Operations":"Λίστα Λειτουργιών",
+    "Expand Operations":"Ανάπτυξη Λειτουργιών",
+    "Raw":"Ακατέργαστο",
+    "can't parse JSON.  Raw result":"αδυναμία ανάλυσης JSON.  Ακατέργαστο αποτέλεσμα",
+    "Example Value":"Παράδειγμα Τιμής",
+    "Model Schema":"Σχήμα Μοντέλου",
+    "Model":"Μοντέλο",
+    "Click to set as parameter value":"Πατήστε για να θέσετε τιμή παραμέτρου",
+    "apply":"εφαρμογή",
+    "Username":"Όνομα χρήση",
+    "Password":"Κωδικός πρόσβασης",
+    "Terms of service":"Όροι χρήσης",
+    "Created by":"Δημιουργήθηκε από",
+    "See more at":"Δείτε περισσότερα στο",
+    "Contact the developer":"Επικοινωνήστε με τον προγραμματιστή",
+    "api version":"έκδοση api",
+    "Response Content Type":"Τύπος Περιεχομένου Απόκρισης",
+    "Parameter content type:":"Τύπος περιεχομένου παραμέτρου:",
+    "fetching resource":"παραλαβή πόρου",
+    "fetching resource list":"παραλαβή λίστας πόρων",
+    "Explore":"Εξερεύνηση",
+    "Show Swagger Petstore Example Apis":"Εμφάνιση Api Δειγμάτων Petstore του Swagger",
+    "Can't read from server.  It may not have the appropriate access-control-origin settings.":"Αδυναμία ανάγνωσης από τον εξυπηρετητή.  Μπορεί να μην έχει κατάλληλες ρυθμίσεις για access-control-origin.",
+    "Please specify the protocol for":"Παρακαλώ προσδιορίστε το πρωτόκολλο για",
+    "Can't read swagger JSON from":"Αδυναμία ανάγνωσης swagger JSON από",
+    "Finished Loading Resource Information. Rendering Swagger UI":"Ολοκλήρωση Φόρτωσης Πληροφορικών Πόρου. Παρουσίαση Swagger UI",
+    "Unable to read api":"Αδυναμία ανάγνωσης api",
+    "from path":"από το μονοπάτι",
+    "server returned":"ο εξυπηρετηρής επέστρεψε"
+});

+ 1 - 0
htdocs/includes/restler/framework/Luracast/Restler/explorer/lang/en.js

@@ -28,6 +28,7 @@ window.SwaggerTranslator.learn({
     "Expand Operations":"Expand Operations",
     "Raw":"Raw",
     "can't parse JSON.  Raw result":"can't parse JSON.  Raw result",
+    "Example Value":"Example Value",
     "Model Schema":"Model Schema",
     "Model":"Model",
     "Click to set as parameter value":"Click to set as parameter value",

+ 1 - 0
htdocs/includes/restler/framework/Luracast/Restler/explorer/lang/es.js

@@ -27,6 +27,7 @@ window.SwaggerTranslator.learn({
     "Expand Operations":"Expandir Operaciones",
     "Raw":"Crudo",
     "can't parse JSON.  Raw result":"no puede parsear el JSON.  Resultado crudo",
+    "Example Value":"Valor de Ejemplo",
     "Model Schema":"Esquema del Modelo",
     "Model":"Modelo",
     "apply":"aplicar",

+ 2 - 1
htdocs/includes/restler/framework/Luracast/Restler/explorer/lang/fr.js

@@ -3,7 +3,7 @@
 /* jshint quotmark: double */
 window.SwaggerTranslator.learn({
     "Warning: Deprecated":"Avertissement : Obsolète",
-    "Implementation Notes":"Notes d'implementation",
+    "Implementation Notes":"Notes d'implémentation",
     "Response Class":"Classe de la réponse",
     "Status":"Statut",
     "Parameters":"Paramètres",
@@ -28,6 +28,7 @@ window.SwaggerTranslator.learn({
     "Expand Operations":"Développer les opérations",
     "Raw":"Brut",
     "can't parse JSON.  Raw result":"impossible de décoder le JSON.  Résultat brut",
+    "Example Value":"Exemple la valeur",
     "Model Schema":"Définition du modèle",
     "Model":"Modèle",
     "apply":"appliquer",

+ 56 - 0
htdocs/includes/restler/framework/Luracast/Restler/explorer/lang/geo.js

@@ -0,0 +1,56 @@
+'use strict';
+
+/* jshint quotmark: double */
+window.SwaggerTranslator.learn({
+    "Warning: Deprecated":"ყურადღება: აღარ გამოიყენება",
+    "Implementation Notes":"იმპლემენტაციის აღწერა",
+    "Response Class":"რესპონს კლასი",
+    "Status":"სტატუსი",
+    "Parameters":"პარამეტრები",
+    "Parameter":"პარამეტრი",
+    "Value":"მნიშვნელობა",
+    "Description":"აღწერა",
+    "Parameter Type":"პარამეტრის ტიპი",
+    "Data Type":"მონაცემის ტიპი",
+    "Response Messages":"პასუხი",
+    "HTTP Status Code":"HTTP სტატუსი",
+    "Reason":"მიზეზი",
+    "Response Model":"რესპონს მოდელი",
+    "Request URL":"მოთხოვნის URL",
+    "Response Body":"პასუხის სხეული",
+    "Response Code":"პასუხის კოდი",
+    "Response Headers":"პასუხის ჰედერები",
+    "Hide Response":"დამალე პასუხი",
+    "Headers":"ჰედერები",
+    "Try it out!":"ცადე !",
+    "Show/Hide":"გამოჩენა/დამალვა",
+    "List Operations":"ოპერაციების სია",
+    "Expand Operations":"ოპერაციები ვრცლად",
+    "Raw":"ნედლი",
+    "can't parse JSON.  Raw result":"JSON-ის დამუშავება ვერ მოხერხდა.  ნედლი პასუხი",
+    "Example Value":"მაგალითი",
+    "Model Schema":"მოდელის სტრუქტურა",
+    "Model":"მოდელი",
+    "Click to set as parameter value":"პარამეტრისთვის მნიშვნელობის მისანიჭებლად, დააკლიკე",
+    "apply":"გამოყენება",
+    "Username":"მოხმარებელი",
+    "Password":"პაროლი",
+    "Terms of service":"მომსახურების პირობები",
+    "Created by":"შექმნა",
+    "See more at":"ნახე ვრცლად",
+    "Contact the developer":"დაუკავშირდი დეველოპერს",
+    "api version":"api ვერსია",
+    "Response Content Type":"პასუხის კონტენტის ტიპი",
+    "Parameter content type:":"პარამეტრის კონტენტის ტიპი:",
+    "fetching resource":"რესურსების მიღება",
+    "fetching resource list":"რესურსების სიის მიღება",
+    "Explore":"ნახვა",
+    "Show Swagger Petstore Example Apis":"ნახე Swagger Petstore სამაგალითო Api",
+    "Can't read from server.  It may not have the appropriate access-control-origin settings.":"სერვერთან დაკავშირება ვერ ხერხდება.  შეამოწმეთ access-control-origin.",
+    "Please specify the protocol for":"მიუთითეთ პროტოკოლი",
+    "Can't read swagger JSON from":"swagger JSON წაკითხვა ვერ მოხერხდა",
+    "Finished Loading Resource Information. Rendering Swagger UI":"რესურსების ჩატვირთვა სრულდება. Swagger UI რენდერდება",
+    "Unable to read api":"api წაკითხვა ვერ მოხერხდა",
+    "from path":"მისამართიდან",
+    "server returned":"სერვერმა დააბრუნა"
+});

+ 6 - 3
htdocs/includes/restler/framework/Luracast/Restler/explorer/lang/ja.js

@@ -26,22 +26,25 @@ window.SwaggerTranslator.learn({
     "Show/Hide":"表示/非表示",
     "List Operations":"操作一覧",
     "Expand Operations":"操作の展開",
-    "Raw":"Raw",
+    "Raw":"未加工",
     "can't parse JSON.  Raw result":"JSONへ解釈できません.  未加工の結果",
+    "Example Value":"値の例",
     "Model Schema":"モデルスキーマ",
     "Model":"モデル",
+    "Click to set as parameter value":"パラメータ値と設定するにはクリック",
     "apply":"実行",
     "Username":"ユーザ名",
     "Password":"パスワード",
     "Terms of service":"サービス利用規約",
     "Created by":"Created by",
-    "See more at":"See more at",
+    "See more at":"詳細を見る",
     "Contact the developer":"開発者に連絡",
     "api version":"APIバージョン",
     "Response Content Type":"レスポンス コンテンツタイプ",
+    "Parameter content type:":"パラメータコンテンツタイプ:",
     "fetching resource":"リソースの取得",
     "fetching resource list":"リソース一覧の取得",
-    "Explore":"Explore",
+    "Explore":"調査",
     "Show Swagger Petstore Example Apis":"SwaggerペットストアAPIの表示",
     "Can't read from server.  It may not have the appropriate access-control-origin settings.":"サーバから読み込めません.  適切なaccess-control-origin設定を持っていない可能性があります.",
     "Please specify the protocol for":"プロトコルを指定してください",

+ 53 - 0
htdocs/includes/restler/framework/Luracast/Restler/explorer/lang/ko-kr.js

@@ -0,0 +1,53 @@
+'use strict';
+
+/* jshint quotmark: double */
+window.SwaggerTranslator.learn({
+    "Warning: Deprecated":"경고:폐기예정됨",
+    "Implementation Notes":"구현 노트",
+    "Response Class":"응답 클래스",
+    "Status":"상태",
+    "Parameters":"매개변수들",
+    "Parameter":"매개변수",
+    "Value":"값",
+    "Description":"설명",
+    "Parameter Type":"매개변수 타입",
+    "Data Type":"데이터 타입",
+    "Response Messages":"응답 메세지",
+    "HTTP Status Code":"HTTP 상태 코드",
+    "Reason":"원인",
+    "Response Model":"응답 모델",
+    "Request URL":"요청 URL",
+    "Response Body":"응답 본문",
+    "Response Code":"응답 코드",
+    "Response Headers":"응답 헤더",
+    "Hide Response":"응답 숨기기",
+    "Headers":"헤더",
+    "Try it out!":"써보기!",
+    "Show/Hide":"보이기/숨기기",
+    "List Operations":"목록 작업",
+    "Expand Operations":"전개 작업",
+    "Raw":"원본",
+    "can't parse JSON.  Raw result":"JSON을 파싱할수 없음. 원본결과:",
+    "Model Schema":"모델 스키마",
+    "Model":"모델",
+    "apply":"적용",
+    "Username":"사용자 이름",
+    "Password":"암호",
+    "Terms of service":"이용약관",
+    "Created by":"작성자",
+    "See more at":"추가정보:",
+    "Contact the developer":"개발자에게 문의",
+    "api version":"api버전",
+    "Response Content Type":"응답Content Type",
+    "fetching resource":"리소스 가져오기",
+    "fetching resource list":"리소스 목록 가져오기",
+    "Explore":"탐색",
+    "Show Swagger Petstore Example Apis":"Swagger Petstore 예제 보기",
+    "Can't read from server.  It may not have the appropriate access-control-origin settings.":"서버로부터 읽어들일수 없습니다. access-control-origin 설정이 올바르지 않을수 있습니다.",
+    "Please specify the protocol for":"다음을 위한 프로토콜을 정하세요",
+    "Can't read swagger JSON from":"swagger JSON 을 다음으로 부터 읽을수 없습니다",
+    "Finished Loading Resource Information. Rendering Swagger UI":"리소스 정보 불러오기 완료. Swagger UI 랜더링",
+    "Unable to read api":"api를 읽을 수 없습니다.",
+    "from path":"다음 경로로 부터",
+    "server returned":"서버 응답함."
+});

+ 1 - 0
htdocs/includes/restler/framework/Luracast/Restler/explorer/lang/ru.js

@@ -28,6 +28,7 @@ window.SwaggerTranslator.learn({
     "Expand Operations":"Операции подробно",
     "Raw":"В сыром виде",
     "can't parse JSON.  Raw result":"Не удается распарсить ответ:",
+    "Example Value":"Пример",
     "Model Schema":"Структура",
     "Model":"Описание",
     "Click to set as parameter value":"Нажмите, чтобы испльзовать в качестве значения параметра",

+ 1 - 1
htdocs/includes/restler/framework/Luracast/Restler/explorer/lang/translator.js

@@ -7,7 +7,7 @@
  * after <script src='lang/translator.js' type='text/javascript'></script>.
  * For example - <script src='lang/ru.js' type='text/javascript'></script>
  *
- * If you wish to translate some new texsts you should do two things:
+ * If you wish to translate some new texts you should do two things:
  * 1. Add a new phrase pair ("New Phrase": "New Translation") into your language file (for example lang/ru.js). It will be great if you add it in other language files too.
  * 2. Mark that text it templates this way <anyHtmlTag data-sw-translate>New Phrase</anyHtmlTag> or <anyHtmlTag data-sw-translate value='New Phrase'/>.
  * The main thing here is attribute data-sw-translate. Only inner html, title-attribute and value-attribute are going to translate.

+ 3 - 0
htdocs/includes/restler/framework/Luracast/Restler/explorer/lang/zh-cn.js

@@ -28,6 +28,8 @@ window.SwaggerTranslator.learn({
     "Expand Operations":"展开操作",
     "Raw":"原始",
     "can't parse JSON.  Raw result":"无法解析JSON. 原始结果",
+    "Example Value":"示例",
+    "Click to set as parameter value":"点击设置参数",
     "Model Schema":"模型架构",
     "Model":"模型",
     "apply":"应用",
@@ -39,6 +41,7 @@ window.SwaggerTranslator.learn({
     "Contact the developer":"联系开发者",
     "api version":"api版本",
     "Response Content Type":"响应Content Type",
+    "Parameter content type:":"参数类型:",
     "fetching resource":"正在获取资源",
     "fetching resource list":"正在获取资源列表",
     "Explore":"浏览",

文件差异内容过多而无法显示
+ 0 - 2
htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/backbone-min.js


文件差异内容过多而无法显示
+ 0 - 0
htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/es5-shim.js


文件差异内容过多而无法显示
+ 0 - 302
htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/handlebars-1.0.0.js


文件差异内容过多而无法显示
+ 0 - 26
htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/handlebars-2.0.0.js


文件差异内容过多而无法显示
+ 0 - 0
htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/handlebars-4.0.5.js


文件差异内容过多而无法显示
+ 0 - 0
htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/highlight.7.3.pack.js


文件差异内容过多而无法显示
+ 0 - 0
htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/highlight.9.1.0.pack.js


+ 1 - 0
htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/highlight.9.1.0.pack_extended.js

@@ -0,0 +1 @@
+"use strict";!function(){var h,l;h=hljs.configure,hljs.configure=function(l){var i=l.highlightSizeThreshold;hljs.highlightSizeThreshold=i===+i?i:null,h.call(this,l)},l=hljs.highlightBlock,hljs.highlightBlock=function(h){var i=h.innerHTML,g=hljs.highlightSizeThreshold;(null==g||g>i.length)&&l.call(hljs,h)}}();

文件差异内容过多而无法显示
+ 0 - 1
htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/jquery-1.8.0.min.js


文件差异内容过多而无法显示
+ 0 - 8
htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/jquery.ba-bbq.min.js


+ 1 - 1
htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/jquery.slideto.min.js

@@ -1 +1 @@
-(function(b){b.fn.slideto=function(a){a=b.extend({slide_duration:"slow",highlight_duration:3E3,highlight:true,highlight_color:"#FFFF99"},a);return this.each(function(){obj=b(this);b("body").animate({scrollTop:obj.offset().top},a.slide_duration,function(){a.highlight&&b.ui.version&&obj.effect("highlight",{color:a.highlight_color},a.highlight_duration)})})}})(jQuery);
+!function(i){i.fn.slideto=function(o){return o=i.extend({slide_duration:"slow",highlight_duration:3e3,highlight:!0,highlight_color:"#FFFF99"},o),this.each(function(){obj=i(this),i("body").animate({scrollTop:obj.offset().top},o.slide_duration,function(){o.highlight&&i.ui.version&&obj.effect("highlight",{color:o.highlight_color},o.highlight_duration)})})}}(jQuery);

+ 1 - 8
htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/jquery.wiggle.min.js

@@ -1,8 +1 @@
-/*
-jQuery Wiggle
-Author: WonderGroup, Jordan Thomas
-URL: http://labs.wondergroup.com/demos/mini-ui/index.html
-License: MIT (http://en.wikipedia.org/wiki/MIT_License)
-*/
-jQuery.fn.wiggle=function(o){var d={speed:50,wiggles:3,travel:5,callback:null};var o=jQuery.extend(d,o);return this.each(function(){var cache=this;var wrap=jQuery(this).wrap('<div class="wiggle-wrap"></div>').css("position","relative");var calls=0;for(i=1;i<=o.wiggles;i++){jQuery(this).animate({left:"-="+o.travel},o.speed).animate({left:"+="+o.travel*2},o.speed*2).animate({left:"-="+o.travel},o.speed,function(){calls++;if(jQuery(cache).parent().hasClass('wiggle-wrap')){jQuery(cache).parent().replaceWith(cache);}
-if(calls==o.wiggles&&jQuery.isFunction(o.callback)){o.callback();}});}});};
+jQuery.fn.wiggle=function(e){var a={speed:50,wiggles:3,travel:5,callback:null},e=jQuery.extend(a,e);return this.each(function(){var a=this,l=(jQuery(this).wrap('<div class="wiggle-wrap"></div>').css("position","relative"),0);for(i=1;i<=e.wiggles;i++)jQuery(this).animate({left:"-="+e.travel},e.speed).animate({left:"+="+2*e.travel},2*e.speed).animate({left:"-="+e.travel},e.speed,function(){l++,jQuery(a).parent().hasClass("wiggle-wrap")&&jQuery(a).parent().replaceWith(a),l==e.wiggles&&jQuery.isFunction(e.callback)&&e.callback()})})};

文件差异内容过多而无法显示
+ 0 - 0
htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/js-yaml.min.js


文件差异内容过多而无法显示
+ 0 - 6
htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/jsoneditor.min.js


文件差异内容过多而无法显示
+ 0 - 0
htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/lodash.min.js


文件差异内容过多而无法显示
+ 0 - 1272
htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/marked.js


+ 1 - 0
htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/object-assign-pollyfill.js

@@ -0,0 +1 @@
+"function"!=typeof Object.assign&&!function(){Object.assign=function(n){"use strict";if(void 0===n||null===n)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(n),o=1;o<arguments.length;o++){var r=arguments[o];if(void 0!==r&&null!==r)for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t}}();

文件差异内容过多而无法显示
+ 0 - 0
htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/sanitize-html.min.js


+ 0 - 2765
htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/shred.bundle.js

@@ -1,2765 +0,0 @@
-var require = function (file, cwd) {
-    var resolved = require.resolve(file, cwd || '/');
-    var mod = require.modules[resolved];
-    if (!mod) throw new Error(
-        'Failed to resolve module ' + file + ', tried ' + resolved
-    );
-    var res = mod._cached ? mod._cached : mod();
-    return res;
-}
-
-require.paths = [];
-require.modules = {};
-require.extensions = [".js",".coffee"];
-
-require._core = {
-    'assert': true,
-    'events': true,
-    'fs': true,
-    'path': true,
-    'vm': true
-};
-
-require.resolve = (function () {
-    return function (x, cwd) {
-        if (!cwd) cwd = '/';
-        
-        if (require._core[x]) return x;
-        var path = require.modules.path();
-        var y = cwd || '.';
-        
-        if (x.match(/^(?:\.\.?\/|\/)/)) {
-            var m = loadAsFileSync(path.resolve(y, x))
-                || loadAsDirectorySync(path.resolve(y, x));
-            if (m) return m;
-        }
-        
-        var n = loadNodeModulesSync(x, y);
-        if (n) return n;
-        
-        throw new Error("Cannot find module '" + x + "'");
-        
-        function loadAsFileSync (x) {
-            if (require.modules[x]) {
-                return x;
-            }
-            
-            for (var i = 0; i < require.extensions.length; i++) {
-                var ext = require.extensions[i];
-                if (require.modules[x + ext]) return x + ext;
-            }
-        }
-        
-        function loadAsDirectorySync (x) {
-            x = x.replace(/\/+$/, '');
-            var pkgfile = x + '/package.json';
-            if (require.modules[pkgfile]) {
-                var pkg = require.modules[pkgfile]();
-                var b = pkg.browserify;
-                if (typeof b === 'object' && b.main) {
-                    var m = loadAsFileSync(path.resolve(x, b.main));
-                    if (m) return m;
-                }
-                else if (typeof b === 'string') {
-                    var m = loadAsFileSync(path.resolve(x, b));
-                    if (m) return m;
-                }
-                else if (pkg.main) {
-                    var m = loadAsFileSync(path.resolve(x, pkg.main));
-                    if (m) return m;
-                }
-            }
-            
-            return loadAsFileSync(x + '/index');
-        }
-        
-        function loadNodeModulesSync (x, start) {
-            var dirs = nodeModulesPathsSync(start);
-            for (var i = 0; i < dirs.length; i++) {
-                var dir = dirs[i];
-                var m = loadAsFileSync(dir + '/' + x);
-                if (m) return m;
-                var n = loadAsDirectorySync(dir + '/' + x);
-                if (n) return n;
-            }
-            
-            var m = loadAsFileSync(x);
-            if (m) return m;
-        }
-        
-        function nodeModulesPathsSync (start) {
-            var parts;
-            if (start === '/') parts = [ '' ];
-            else parts = path.normalize(start).split('/');
-            
-            var dirs = [];
-            for (var i = parts.length - 1; i >= 0; i--) {
-                if (parts[i] === 'node_modules') continue;
-                var dir = parts.slice(0, i + 1).join('/') + '/node_modules';
-                dirs.push(dir);
-            }
-            
-            return dirs;
-        }
-    };
-})();
-
-require.alias = function (from, to) {
-    var path = require.modules.path();
-    var res = null;
-    try {
-        res = require.resolve(from + '/package.json', '/');
-    }
-    catch (err) {
-        res = require.resolve(from, '/');
-    }
-    var basedir = path.dirname(res);
-    
-    var keys = (Object.keys || function (obj) {
-        var res = [];
-        for (var key in obj) res.push(key)
-        return res;
-    })(require.modules);
-    
-    for (var i = 0; i < keys.length; i++) {
-        var key = keys[i];
-        if (key.slice(0, basedir.length + 1) === basedir + '/') {
-            var f = key.slice(basedir.length);
-            require.modules[to + f] = require.modules[basedir + f];
-        }
-        else if (key === basedir) {
-            require.modules[to] = require.modules[basedir];
-        }
-    }
-};
-
-require.define = function (filename, fn) {
-    var dirname = require._core[filename]
-        ? ''
-        : require.modules.path().dirname(filename)
-    ;
-    
-    var require_ = function (file) {
-        return require(file, dirname)
-    };
-    require_.resolve = function (name) {
-        return require.resolve(name, dirname);
-    };
-    require_.modules = require.modules;
-    require_.define = require.define;
-    var module_ = { exports : {} };
-    
-    require.modules[filename] = function () {
-        require.modules[filename]._cached = module_.exports;
-        fn.call(
-            module_.exports,
-            require_,
-            module_,
-            module_.exports,
-            dirname,
-            filename
-        );
-        require.modules[filename]._cached = module_.exports;
-        return module_.exports;
-    };
-};
-
-if (typeof process === 'undefined') process = {};
-
-if (!process.nextTick) process.nextTick = (function () {
-    var queue = [];
-    var canPost = typeof window !== 'undefined'
-        && window.postMessage && window.addEventListener
-    ;
-    
-    if (canPost) {
-        window.addEventListener('message', function (ev) {
-            if (ev.source === window && ev.data === 'browserify-tick') {
-                ev.stopPropagation();
-                if (queue.length > 0) {
-                    var fn = queue.shift();
-                    fn();
-                }
-            }
-        }, true);
-    }
-    
-    return function (fn) {
-        if (canPost) {
-            queue.push(fn);
-            window.postMessage('browserify-tick', '*');
-        }
-        else setTimeout(fn, 0);
-    };
-})();
-
-if (!process.title) process.title = 'browser';
-
-if (!process.binding) process.binding = function (name) {
-    if (name === 'evals') return require('vm')
-    else throw new Error('No such module')
-};
-
-if (!process.cwd) process.cwd = function () { return '.' };
-
-require.define("path", function (require, module, exports, __dirname, __filename) {
-    function filter (xs, fn) {
-    var res = [];
-    for (var i = 0; i < xs.length; i++) {
-        if (fn(xs[i], i, xs)) res.push(xs[i]);
-    }
-    return res;
-}
-
-// resolves . and .. elements in a path array with directory names there
-// must be no slashes, empty elements, or device names (c:\) in the array
-// (so also no leading and trailing slashes - it does not distinguish
-// relative and absolute paths)
-function normalizeArray(parts, allowAboveRoot) {
-  // if the path tries to go above the root, `up` ends up > 0
-  var up = 0;
-  for (var i = parts.length; i >= 0; i--) {
-    var last = parts[i];
-    if (last == '.') {
-      parts.splice(i, 1);
-    } else if (last === '..') {
-      parts.splice(i, 1);
-      up++;
-    } else if (up) {
-      parts.splice(i, 1);
-      up--;
-    }
-  }
-
-  // if the path is allowed to go above the root, restore leading ..s
-  if (allowAboveRoot) {
-    for (; up--; up) {
-      parts.unshift('..');
-    }
-  }
-
-  return parts;
-}
-
-// Regex to split a filename into [*, dir, basename, ext]
-// posix version
-var splitPathRe = /^(.+\/(?!$)|\/)?((?:.+?)?(\.[^.]*)?)$/;
-
-// path.resolve([from ...], to)
-// posix version
-exports.resolve = function() {
-var resolvedPath = '',
-    resolvedAbsolute = false;
-
-for (var i = arguments.length; i >= -1 && !resolvedAbsolute; i--) {
-  var path = (i >= 0)
-      ? arguments[i]
-      : process.cwd();
-
-  // Skip empty and invalid entries
-  if (typeof path !== 'string' || !path) {
-    continue;
-  }
-
-  resolvedPath = path + '/' + resolvedPath;
-  resolvedAbsolute = path.charAt(0) === '/';
-}
-
-// At this point the path should be resolved to a full absolute path, but
-// handle relative paths to be safe (might happen when process.cwd() fails)
-
-// Normalize the path
-resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {
-    return !!p;
-  }), !resolvedAbsolute).join('/');
-
-  return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';
-};
-
-// path.normalize(path)
-// posix version
-exports.normalize = function(path) {
-var isAbsolute = path.charAt(0) === '/',
-    trailingSlash = path.slice(-1) === '/';
-
-// Normalize the path
-path = normalizeArray(filter(path.split('/'), function(p) {
-    return !!p;
-  }), !isAbsolute).join('/');
-
-  if (!path && !isAbsolute) {
-    path = '.';
-  }
-  if (path && trailingSlash) {
-    path += '/';
-  }
-  
-  return (isAbsolute ? '/' : '') + path;
-};
-
-
-// posix version
-exports.join = function() {
-  var paths = Array.prototype.slice.call(arguments, 0);
-  return exports.normalize(filter(paths, function(p, index) {
-    return p && typeof p === 'string';
-  }).join('/'));
-};
-
-
-exports.dirname = function(path) {
-  var dir = splitPathRe.exec(path)[1] || '';
-  var isWindows = false;
-  if (!dir) {
-    // No dirname
-    return '.';
-  } else if (dir.length === 1 ||
-      (isWindows && dir.length <= 3 && dir.charAt(1) === ':')) {
-    // It is just a slash or a drive letter with a slash
-    return dir;
-  } else {
-    // It is a full dirname, strip trailing slash
-    return dir.substring(0, dir.length - 1);
-  }
-};
-
-
-exports.basename = function(path, ext) {
-  var f = splitPathRe.exec(path)[2] || '';
-  // TODO: make this comparison case-insensitive on windows?
-  if (ext && f.substr(-1 * ext.length) === ext) {
-    f = f.substr(0, f.length - ext.length);
-  }
-  return f;
-};
-
-
-exports.extname = function(path) {
-  return splitPathRe.exec(path)[3] || '';
-};
-
-});
-
-require.define("/shred.js", function (require, module, exports, __dirname, __filename) {
-    // Shred is an HTTP client library intended to simplify the use of Node's
-// built-in HTTP library. In particular, we wanted to make it easier to interact
-// with HTTP-based APIs.
-// 
-// See the [examples](./examples.html) for more details.
-
-// Ax is a nice logging library we wrote. You can use any logger, providing it
-// has `info`, `warn`, `debug`, and `error` methods that take a string.
-var Ax = require("ax")
-  , CookieJarLib = require( "cookiejar" )
-  , CookieJar = CookieJarLib.CookieJar
-;
-
-// Shred takes some options, including a logger and request defaults.
-
-var Shred = function(options) {
-  options = (options||{});
-  this.agent = options.agent;
-  this.defaults = options.defaults||{};
-  this.log = options.logger||(new Ax({ level: "info" }));
-  this._sharedCookieJar = new CookieJar();
-  this.logCurl = options.logCurl || false;
-};
-
-// Most of the real work is done in the request and reponse classes.
- 
-Shred.Request = require("./shred/request");
-Shred.Response = require("./shred/response");
-
-// The `request` method kicks off a new request, instantiating a new `Request`
-// object and passing along whatever default options we were given.
-
-Shred.prototype = {
-  request: function(options) {
-    options.logger = this.log;
-    options.logCurl = options.logCurl || this.logCurl;
-    options.cookieJar = ( 'cookieJar' in options ) ? options.cookieJar : this._sharedCookieJar; // let them set cookieJar = null
-    options.agent = options.agent || this.agent;
-    // fill in default options
-    for (var key in this.defaults) {
-      if (this.defaults.hasOwnProperty(key) && !options[key]) {
-        options[key] = this.defaults[key]
-      }
-    }
-    return new Shred.Request(options);
-  }
-};
-
-// Define a bunch of convenience methods so that you don't have to include
-// a `method` property in your request options.
-
-"get put post delete".split(" ").forEach(function(method) {
-  Shred.prototype[method] = function(options) {
-    options.method = method;
-    return this.request(options);
-  };
-});
-
-
-module.exports = Shred;
-
-});
-
-require.define("/node_modules/ax/package.json", function (require, module, exports, __dirname, __filename) {
-    module.exports = {"main":"./lib/ax.js"}
-});
-
-require.define("/node_modules/ax/lib/ax.js", function (require, module, exports, __dirname, __filename) {
-    var inspect = require("util").inspect
-  , fs = require("fs")
-;
-
-
-// this is a quick-and-dirty logger. there are other nicer loggers out there
-// but the ones i found were also somewhat involved. this one has a Ruby
-// logger type interface
-//
-// we can easily replace this, provide the info, debug, etc. methods are the
-// same. or, we can change Haiku to use a more standard node.js interface
-
-var format = function(level,message) {
-  var debug = (level=="debug"||level=="error");
-  if (!message) { return message.toString(); }
-  if (typeof(message) == "object") {
-    if (message instanceof Error && debug) {
-      return message.stack;
-    } else {
-      return inspect(message);
-    }
-  } else {
-    return message.toString();
-  }
-};
-
-var noOp = function(message) { return this; }
-var makeLogger = function(level,fn) {
-  return function(message) { 
-    this.stream.write(this.format(level, message)+"\n");
-    return this;
-  }
-};
-
-var Logger = function(options) {
-  var logger = this;
-  var options = options||{};
-
-  // Default options
-  options.level = options.level || "info";
-  options.timestamp = options.timestamp || true;
-  options.prefix = options.prefix || "";
-  logger.options = options;
-
-  // Allows a prefix to be added to the message.
-  //
-  //    var logger = new Ax({ module: 'Haiku' })
-  //    logger.warn('this is going to be awesome!');
-  //    //=> Haiku: this is going to be awesome!
-  //
-  if (logger.options.module){
-    logger.options.prefix = logger.options.module;
-  }
-
-  // Write to stderr or a file
-  if (logger.options.file){
-    logger.stream = fs.createWriteStream(logger.options.file, {"flags": "a"});
-  } else {
-      if(process.title === "node")
-    logger.stream = process.stderr;
-      else if(process.title === "browser")
-    logger.stream = function () {
-      // Work around weird console context issue: http://code.google.com/p/chromium/issues/detail?id=48662
-      return console[logger.options.level].apply(console, arguments);
-    };
-  }
-
-  switch(logger.options.level){
-    case 'debug':
-      ['debug', 'info', 'warn'].forEach(function (level) {
-        logger[level] = Logger.writer(level);
-      });
-    case 'info':
-      ['info', 'warn'].forEach(function (level) {
-        logger[level] = Logger.writer(level);
-      });
-    case 'warn':
-      logger.warn = Logger.writer('warn');
-  }
-}
-
-// Used to define logger methods
-Logger.writer = function(level){
-  return function(message){
-    var logger = this;
-
-    if(process.title === "node")
-  logger.stream.write(logger.format(level, message) + '\n');
-    else if(process.title === "browser")
-  logger.stream(logger.format(level, message) + '\n');
-
-  };
-}
-
-
-Logger.prototype = {
-  info: function(){},
-  debug: function(){},
-  warn: function(){},
-  error: Logger.writer('error'),
-  format: function(level, message){
-    if (! message) return '';
-
-    var logger = this
-      , prefix = logger.options.prefix
-      , timestamp = logger.options.timestamp ? " " + (new Date().toISOString()) : ""
-    ;
-
-    return (prefix + timestamp + ": " + message);
-  }
-};
-
-module.exports = Logger;
-
-});
-
-require.define("util", function (require, module, exports, __dirname, __filename) {
-    // todo
-
-});
-
-require.define("fs", function (require, module, exports, __dirname, __filename) {
-    // nothing to see here... no file methods for the browser
-
-});
-
-require.define("/node_modules/cookiejar/package.json", function (require, module, exports, __dirname, __filename) {
-    module.exports = {"main":"cookiejar.js"}
-});
-
-require.define("/node_modules/cookiejar/cookiejar.js", function (require, module, exports, __dirname, __filename) {
-    exports.CookieAccessInfo=CookieAccessInfo=function CookieAccessInfo(domain,path,secure,script) {
-    if(this instanceof CookieAccessInfo) {
-      this.domain=domain||undefined;
-      this.path=path||"/";
-      this.secure=!!secure;
-      this.script=!!script;
-      return this;
-    }
-    else {
-        return new CookieAccessInfo(domain,path,secure,script)    
-    }
-}
-
-exports.Cookie=Cookie=function Cookie(cookiestr) {
-  if(cookiestr instanceof Cookie) {
-    return cookiestr;
-  }
-    else {
-        if(this instanceof Cookie) {
-          this.name = null;
-          this.value = null;
-          this.expiration_date = Infinity;
-          this.path = "/";
-          this.domain = null;
-          this.secure = false; //how to define?
-          this.noscript = false; //httponly
-          if(cookiestr) {
-            this.parse(cookiestr)
-          }
-          return this;
-        }
-        return new Cookie(cookiestr)
-    }
-}
-
-Cookie.prototype.toString = function toString() {
-  var str=[this.name+"="+this.value];
-  if(this.expiration_date !== Infinity) {
-    str.push("expires="+(new Date(this.expiration_date)).toGMTString());
-  }
-  if(this.domain) {
-    str.push("domain="+this.domain);
-  }
-  if(this.path) {
-    str.push("path="+this.path);
-  }
-  if(this.secure) {
-    str.push("secure");
-  }
-  if(this.noscript) {
-    str.push("httponly");
-  }
-  return str.join("; ");
-}
-
-Cookie.prototype.toValueString = function toValueString() {
-  return this.name+"="+this.value;
-}
-
-var cookie_str_splitter=/[:](?=\s*[a-zA-Z0-9_\-]+\s*[=])/g
-Cookie.prototype.parse = function parse(str) {
-  if(this instanceof Cookie) {
-      var parts=str.split(";")
-      , pair=parts[0].match(/([^=]+)=((?:.|\n)*)/)
-      , key=pair[1]
-      , value=pair[2];
-      this.name = key;
-      this.value = value;
-    
-      for(var i=1;i<parts.length;i++) {
-        pair=parts[i].match(/([^=]+)(?:=((?:.|\n)*))?/)
-        , key=pair[1].trim().toLowerCase()
-        , value=pair[2];
-        switch(key) {
-          case "httponly":
-            this.noscript = true;
-          break;
-          case "expires":
-            this.expiration_date = value
-              ? Number(Date.parse(value))
-              : Infinity;
-          break;
-          case "path":
-            this.path = value
-              ? value.trim()
-              : "";
-          break;
-          case "domain":
-            this.domain = value
-              ? value.trim()
-              : "";
-          break;
-          case "secure":
-            this.secure = true;
-          break
-        }
-      }
-    
-      return this;
-  }
-    return new Cookie().parse(str)
-}
-
-Cookie.prototype.matches = function matches(access_info) {
-  if(this.noscript && access_info.script
-  || this.secure && !access_info.secure
-  || !this.collidesWith(access_info)) {
-    return false
-  }
-  return true;
-}
-
-Cookie.prototype.collidesWith = function collidesWith(access_info) {
-  if((this.path && !access_info.path) || (this.domain && !access_info.domain)) {
-    return false
-  }
-  if(this.path && access_info.path.indexOf(this.path) !== 0) {
-    return false;
-  }
-  if (this.domain===access_info.domain) {
-    return true;
-  }
-  else if(this.domain && this.domain.charAt(0)===".")
-  {
-    var wildcard=access_info.domain.indexOf(this.domain.slice(1))
-    if(wildcard===-1 || wildcard!==access_info.domain.length-this.domain.length+1) {
-      return false;
-    }
-  }
-  else if(this.domain){
-    return false
-  }
-  return true;
-}
-
-exports.CookieJar=CookieJar=function CookieJar() {
-  if(this instanceof CookieJar) {
-      var cookies = {} //name: [Cookie]
-    
-      this.setCookie = function setCookie(cookie) {
-        cookie = Cookie(cookie);
-        //Delete the cookie if the set is past the current time
-        var remove = cookie.expiration_date <= Date.now();
-        if(cookie.name in cookies) {
-          var cookies_list = cookies[cookie.name];
-          for(var i=0;i<cookies_list.length;i++) {
-            var collidable_cookie = cookies_list[i];
-            if(collidable_cookie.collidesWith(cookie)) {
-              if(remove) {
-                cookies_list.splice(i,1);
-                if(cookies_list.length===0) {
-                  delete cookies[cookie.name]
-                }
-                return false;
-              }
-              else {
-                return cookies_list[i]=cookie;
-              }
-            }
-          }
-          if(remove) {
-            return false;
-          }
-          cookies_list.push(cookie);
-          return cookie;
-        }
-        else if(remove){
-          return false;
-        }
-        else {
-          return cookies[cookie.name]=[cookie];
-        }
-      }
-      //returns a cookie
-      this.getCookie = function getCookie(cookie_name,access_info) {
-        var cookies_list = cookies[cookie_name];
-        for(var i=0;i<cookies_list.length;i++) {
-          var cookie = cookies_list[i];
-          if(cookie.expiration_date <= Date.now()) {
-            if(cookies_list.length===0) {
-              delete cookies[cookie.name]
-            }
-            continue;
-          }
-          if(cookie.matches(access_info)) {
-            return cookie;
-          }
-        }
-      }
-      //returns a list of cookies
-      this.getCookies = function getCookies(access_info) {
-        var matches=[];
-        for(var cookie_name in cookies) {
-          var cookie=this.getCookie(cookie_name,access_info);
-          if (cookie) {
-            matches.push(cookie);
-          }
-        }
-        matches.toString=function toString(){return matches.join(":");}
-            matches.toValueString=function() {return matches.map(function(c){return c.toValueString();}).join(';');}
-        return matches;
-      }
-    
-      return this;
-  }
-    return new CookieJar()
-}
-
-
-//returns list of cookies that were set correctly
-CookieJar.prototype.setCookies = function setCookies(cookies) {
-  cookies=Array.isArray(cookies)
-    ?cookies
-    :cookies.split(cookie_str_splitter);
-  var successful=[]
-  for(var i=0;i<cookies.length;i++) {
-    var cookie = Cookie(cookies[i]);
-    if(this.setCookie(cookie)) {
-      successful.push(cookie);
-    }
-  }
-  return successful;
-}
-
-});
-
-require.define("/shred/request.js", function (require, module, exports, __dirname, __filename) {
-    // The request object encapsulates a request, creating a Node.js HTTP request and
-// then handling the response.
-
-var HTTP = require("http")
-  , HTTPS = require("https")
-  , parseUri = require("./parseUri")
-  , Emitter = require('events').EventEmitter
-  , sprintf = require("sprintf").sprintf
-  , Response = require("./response")
-  , HeaderMixins = require("./mixins/headers")
-  , Content = require("./content")
-;
-
-var STATUS_CODES = HTTP.STATUS_CODES || {
-    100 : 'Continue',
-    101 : 'Switching Protocols',
-    102 : 'Processing', // RFC 2518, obsoleted by RFC 4918
-    200 : 'OK',
-    201 : 'Created',
-    202 : 'Accepted',
-    203 : 'Non-Authoritative Information',
-    204 : 'No Content',
-    205 : 'Reset Content',
-    206 : 'Partial Content',
-    207 : 'Multi-Status', // RFC 4918
-    300 : 'Multiple Choices',
-    301 : 'Moved Permanently',
-    302 : 'Moved Temporarily',
-    303 : 'See Other',
-    304 : 'Not Modified',
-    305 : 'Use Proxy',
-    307 : 'Temporary Redirect',
-    400 : 'Bad Request',
-    401 : 'Unauthorized',
-    402 : 'Payment Required',
-    403 : 'Forbidden',
-    404 : 'Not Found',
-    405 : 'Method Not Allowed',
-    406 : 'Not Acceptable',
-    407 : 'Proxy Authentication Required',
-    408 : 'Request Time-out',
-    409 : 'Conflict',
-    410 : 'Gone',
-    411 : 'Length Required',
-    412 : 'Precondition Failed',
-    413 : 'Request Entity Too Large',
-    414 : 'Request-URI Too Large',
-    415 : 'Unsupported Media Type',
-    416 : 'Requested Range Not Satisfiable',
-    417 : 'Expectation Failed',
-    418 : 'I\'m a teapot', // RFC 2324
-    422 : 'Unprocessable Entity', // RFC 4918
-    423 : 'Locked', // RFC 4918
-    424 : 'Failed Dependency', // RFC 4918
-    425 : 'Unordered Collection', // RFC 4918
-    426 : 'Upgrade Required', // RFC 2817
-    500 : 'Internal Server Error',
-    501 : 'Not Implemented',
-    502 : 'Bad Gateway',
-    503 : 'Service Unavailable',
-    504 : 'Gateway Time-out',
-    505 : 'HTTP Version not supported',
-    506 : 'Variant Also Negotiates', // RFC 2295
-    507 : 'Insufficient Storage', // RFC 4918
-    509 : 'Bandwidth Limit Exceeded',
-    510 : 'Not Extended' // RFC 2774
-};
-
-// The Shred object itself constructs the `Request` object. You should rarely
-// need to do this directly.
-
-var Request = function(options) {
-  this.log = options.logger;
-  this.cookieJar = options.cookieJar;
-  this.encoding = options.encoding;
-  this.logCurl = options.logCurl;
-  processOptions(this,options||{});
-  createRequest(this);
-};
-
-// A `Request` has a number of properties, many of which help with details like
-// URL parsing or defaulting the port for the request.
-
-Object.defineProperties(Request.prototype, {
-
-// - **url**. You can set the `url` property with a valid URL string and all the
-//   URL-related properties (host, port, etc.) will be automatically set on the
-//   request object.
-
-  url: {
-    get: function() {
-      if (!this.scheme) { return null; }
-      return sprintf("%s://%s:%s%s",
-          this.scheme, this.host, this.port,
-          (this.proxy ? "/" : this.path) +
-          (this.query ? ("?" + this.query) : ""));
-    },
-    set: function(_url) {
-      _url = parseUri(_url);
-      this.scheme = _url.protocol;
-      this.host = _url.host;
-      this.port = _url.port;
-      this.path = _url.path;
-      this.query = _url.query;
-      return this;
-    },
-    enumerable: true
-  },
-
-// - **headers**. Returns a hash representing the request headers. You can't set
-//   this directly, only get it. You can add or modify headers by using the
-//   `setHeader` or `setHeaders` method. This ensures that the headers are
-//   normalized - that is, you don't accidentally send `Content-Type` and
-//   `content-type` headers. Keep in mind that if you modify the returned hash,
-//   it will *not* modify the request headers.
-
-  headers: {
-    get: function() {
-      return this.getHeaders();
-    },
-    enumerable: true
-  },
-
-// - **port**. Unless you set the `port` explicitly or include it in the URL, it
-//   will default based on the scheme.
-
-  port: {
-    get: function() {
-      if (!this._port) {
-        switch(this.scheme) {
-          case "https": return this._port = 443;
-          case "http":
-          default: return this._port = 80;
-        }
-      }
-      return this._port;
-    },
-    set: function(value) { this._port = value; return this; },
-    enumerable: true
-  },
-
-// - **method**. The request method - `get`, `put`, `post`, etc. that will be
-//   used to make the request. Defaults to `get`.
-
-  method: {
-    get: function() {
-      return this._method = (this._method||"GET");
-    },
-    set: function(value) {
-      this._method = value; return this;
-    },
-    enumerable: true
-  },
-
-// - **query**. Can be set either with a query string or a hash (object). Get
-//   will always return a properly escaped query string or null if there is no
-//   query component for the request.
-
-  query: {
-    get: function() {return this._query;},
-    set: function(value) {
-      var stringify = function (hash) {
-        var query = "";
-        for (var key in hash) {
-          query += encodeURIComponent(key) + '=' + encodeURIComponent(hash[key]) + '&';
-        }
-        // Remove the last '&'
-        query = query.slice(0, -1);
-        return query;
-      }
-
-      if (value) {
-        if (typeof value === 'object') {
-          value = stringify(value);
-        }
-        this._query = value;
-      } else {
-        this._query = "";
-      }
-      return this;
-    },
-    enumerable: true
-  },
-
-// - **parameters**. This will return the query parameters in the form of a hash
-//   (object).
-
-  parameters: {
-    get: function() { return QueryString.parse(this._query||""); },
-    enumerable: true
-  },
-
-// - **content**. (Aliased as `body`.) Set this to add a content entity to the
-//   request. Attempts to use the `content-type` header to determine what to do
-//   with the content value. Get this to get back a [`Content`
-//   object](./content.html).
-
-  body: {
-    get: function() { return this._body; },
-    set: function(value) {
-      this._body = new Content({
-        data: value,
-        type: this.getHeader("Content-Type")
-      });
-      this.setHeader("Content-Type",this.content.type);
-      this.setHeader("Content-Length",this.content.length);
-      return this;
-    },
-    enumerable: true
-  },
-
-// - **timeout**. Used to determine how long to wait for a response. Does not
-//   distinguish between connect timeouts versus request timeouts. Set either in
-//   milliseconds or with an object with temporal attributes (hours, minutes,
-//   seconds) and convert it into milliseconds. Get will always return
-//   milliseconds.
-
-  timeout: {
-    get: function() { return this._timeout; }, // in milliseconds
-    set: function(timeout) {
-      var request = this
-        , milliseconds = 0;
-      ;
-      if (!timeout) return this;
-      if (typeof timeout==="number") { milliseconds = timeout; }
-      else {
-        milliseconds = (timeout.milliseconds||0) +
-          (1000 * ((timeout.seconds||0) +
-              (60 * ((timeout.minutes||0) +
-                (60 * (timeout.hours||0))))));
-      }
-      this._timeout = milliseconds;
-      return this;
-    },
-    enumerable: true
-  }
-});
-
-// Alias `body` property to `content`. Since the [content object](./content.html)
-// has a `body` attribute, it's preferable to use `content` since you can then
-// access the raw content data using `content.body`.
-
-Object.defineProperty(Request.prototype,"content",
-    Object.getOwnPropertyDescriptor(Request.prototype, "body"));
-
-// The `Request` object can be pretty overwhelming to view using the built-in
-// Node.js inspect method. We want to make it a bit more manageable. This
-// probably goes [too far in the other
-// direction](https://github.com/spire-io/shred/issues/2).
-
-Request.prototype.inspect = function () {
-  var request = this;
-  var headers = this.format_headers();
-  var summary = ["<Shred Request> ", request.method.toUpperCase(),
-      request.url].join(" ")
-  return [ summary, "- Headers:", headers].join("\n");
-};
-
-Request.prototype.format_headers = function () {
-  var array = []
-  var headers = this._headers
-  for (var key in headers) {
-    if (headers.hasOwnProperty(key)) {
-      var value = headers[key]
-      array.push("\t" + key + ": " + value);
-    }
-  }
-  return array.join("\n");
-};
-
-// Allow chainable 'on's:  shred.get({ ... }).on( ... ).  You can pass in a
-// single function, a pair (event, function), or a hash:
-// { event: function, event: function }
-Request.prototype.on = function (eventOrHash, listener) {
-  var emitter = this.emitter;
-  // Pass in a single argument as a function then make it the default response handler
-  if (arguments.length === 1 && typeof(eventOrHash) === 'function') {
-    emitter.on('response', eventOrHash);
-  } else if (arguments.length === 1 && typeof(eventOrHash) === 'object') {
-    for (var key in eventOrHash) {
-      if (eventOrHash.hasOwnProperty(key)) {
-        emitter.on(key, eventOrHash[key]);
-      }
-    }
-  } else {
-    emitter.on(eventOrHash, listener);
-  }
-  return this;
-};
-
-// Add in the header methods. Again, these ensure we don't get the same header
-// multiple times with different case conventions.
-HeaderMixins.gettersAndSetters(Request);
-
-// `processOptions` is called from the constructor to handle all the work
-// associated with making sure we do our best to ensure we have a valid request.
-
-var processOptions = function(request,options) {
-
-  request.log.debug("Processing request options ..");
-
-  // We'll use `request.emitter` to manage the `on` event handlers.
-  request.emitter = (new Emitter);
-
-  request.agent = options.agent;
-
-  // Set up the handlers ...
-  if (options.on) {
-    for (var key in options.on) {
-      if (options.on.hasOwnProperty(key)) {
-        request.emitter.on(key, options.on[key]);
-      }
-    }
-  }
-
-  // Make sure we were give a URL or a host
-  if (!options.url && !options.host) {
-    request.emitter.emit("request_error",
-        new Error("No url or url options (host, port, etc.)"));
-    return;
-  }
-
-  // Allow for the [use of a proxy](http://www.jmarshall.com/easy/http/#proxies).
-
-  if (options.url) {
-    if (options.proxy) {
-      request.url = options.proxy;
-      request.path = options.url;
-    } else {
-      request.url = options.url;
-    }
-  }
-
-  // Set the remaining options.
-  request.query = options.query||options.parameters||request.query ;
-  request.method = options.method;
-  request.setHeader("user-agent",options.agent||"Shred");
-  request.setHeaders(options.headers);
-
-  if (request.cookieJar) {
-    var cookies = request.cookieJar.getCookies( CookieAccessInfo( request.host, request.path ) );
-    if (cookies.length) {
-      var cookieString = request.getHeader('cookie')||'';
-      for (var cookieIndex = 0; cookieIndex < cookies.length; ++cookieIndex) {
-          if ( cookieString.length && cookieString[ cookieString.length - 1 ] != ';' )
-          {
-              cookieString += ';';
-          }
-          cookieString += cookies[ cookieIndex ].name + '=' + cookies[ cookieIndex ].value + ';';
-      }
-      request.setHeader("cookie", cookieString);
-    }
-  }
-  
-  // The content entity can be set either using the `body` or `content` attributes.
-  if (options.body||options.content) {
-    request.content = options.body||options.content;
-  }
-  request.timeout = options.timeout;
-
-};
-
-// `createRequest` is also called by the constructor, after `processOptions`.
-// This actually makes the request and processes the response, so `createRequest`
-// is a bit of a misnomer.
-
-var createRequest = function(request) {
-  var timeout ;
-
-  request.log.debug("Creating request ..");
-  request.log.debug(request);
-
-  var reqParams = {
-    host: request.host,
-    port: request.port,
-    method: request.method,
-    path: request.path + (request.query ? '?'+request.query : ""),
-    headers: request.getHeaders(),
-    // Node's HTTP/S modules will ignore this, but we are using the
-    // browserify-http module in the browser for both HTTP and HTTPS, and this
-    // is how you differentiate the two.
-    scheme: request.scheme,
-    // Use a provided agent.  'Undefined' is the default, which uses a global
-    // agent.
-    agent: request.agent
-  };
-
-  if (request.logCurl) {
-    logCurl(request);
-  }
-
-  var http = request.scheme == "http" ? HTTP : HTTPS;
-
-  // Set up the real request using the selected library. The request won't be
-  // sent until we call `.end()`.
-  request._raw = http.request(reqParams, function(response) {
-    request.log.debug("Received response ..");
-
-    // We haven't timed out and we have a response, so make sure we clear the
-    // timeout so it doesn't fire while we're processing the response.
-    clearTimeout(timeout);
-
-    // Construct a Shred `Response` object from the response. This will stream
-    // the response, thus the need for the callback. We can access the response
-    // entity safely once we're in the callback.
-    response = new Response(response, request, function(response) {
-
-      // Set up some event magic. The precedence is given first to
-      // status-specific handlers, then to responses for a given event, and then
-      // finally to the more general `response` handler. In the last case, we
-      // need to first make sure we're not dealing with a a redirect.
-      var emit = function(event) {
-        var emitter = request.emitter;
-        var textStatus = STATUS_CODES[response.status] ? STATUS_CODES[response.status].toLowerCase() : null;
-        if (emitter.listeners(response.status).length > 0 || emitter.listeners(textStatus).length > 0) {
-          emitter.emit(response.status, response);
-          emitter.emit(textStatus, response);
-        } else {
-          if (emitter.listeners(event).length>0) {
-            emitter.emit(event, response);
-          } else if (!response.isRedirect) {
-            emitter.emit("response", response);
-            //console.warn("Request has no event listener for status code " + response.status);
-          }
-        }
-      };
-
-      // Next, check for a redirect. We simply repeat the request with the URL
-      // given in the `Location` header. We fire a `redirect` event.
-      if (response.isRedirect) {
-        request.log.debug("Redirecting to "
-            + response.getHeader("Location"));
-        request.url = response.getHeader("Location");
-        emit("redirect");
-        createRequest(request);
-
-      // Okay, it's not a redirect. Is it an error of some kind?
-      } else if (response.isError) {
-        emit("error");
-      } else {
-      // It looks like we're good shape. Trigger the `success` event.
-        emit("success");
-      }
-    });
-  });
-
-  // We're still setting up the request. Next, we're going to handle error cases
-  // where we have no response. We don't emit an error event because that event
-  // takes a response. We don't response handlers to have to check for a null
-  // value. However, we [should introduce a different event
-  // type](https://github.com/spire-io/shred/issues/3) for this type of error.
-  request._raw.on("error", function(error) {
-    request.emitter.emit("request_error", error);
-  });
-
-  request._raw.on("socket", function(socket) {
-    request.emitter.emit("socket", socket);
-  });
-
-  // TCP timeouts should also trigger the "response_error" event.
-  request._raw.on('socket', function () {
-    request._raw.socket.on('timeout', function () {
-      // This should trigger the "error" event on the raw request, which will
-      // trigger the "response_error" on the shred request.
-      request._raw.abort();
-    });
-  });
-
-
-  // We're almost there. Next, we need to write the request entity to the
-  // underlying request object.
-  if (request.content) {
-    request.log.debug("Streaming body: '" +
-        request.content.data.slice(0,59) + "' ... ");
-    request._raw.write(request.content.data);
-  }
-
-  // Finally, we need to set up the timeout. We do this last so that we don't
-  // start the clock ticking until the last possible moment.
-  if (request.timeout) {
-    timeout = setTimeout(function() {
-      request.log.debug("Timeout fired, aborting request ...");
-      request._raw.abort();
-      request.emitter.emit("timeout", request);
-    },request.timeout);
-  }
-
-  // The `.end()` method will cause the request to fire. Technically, it might
-  // have already sent the headers and body.
-  request.log.debug("Sending request ...");
-  request._raw.end();
-};
-
-// Logs the curl command for the request.
-var logCurl = function (req) {
-  var headers = req.getHeaders();
-  var headerString = "";
-
-  for (var key in headers) {
-    headerString += '-H "' + key + ": " + headers[key] + '" ';
-  }
-
-  var bodyString = ""
-
-  if (req.content) {
-    bodyString += "-d '" + req.content.body + "' ";
-  }
-
-  var query = req.query ? '?' + req.query : "";
-
-  console.log("curl " +
-    "-X " + req.method.toUpperCase() + " " +
-    req.scheme + "://" + req.host + ":" + req.port + req.path + query + " " +
-    headerString +
-    bodyString
-  );
-};
-
-
-module.exports = Request;
-
-});
-
-require.define("http", function (require, module, exports, __dirname, __filename) {
-    // todo
-
-});
-
-require.define("https", function (require, module, exports, __dirname, __filename) {
-    // todo
-
-});
-
-require.define("/shred/parseUri.js", function (require, module, exports, __dirname, __filename) {
-    // parseUri 1.2.2
-// (c) Steven Levithan <stevenlevithan.com>
-// MIT License
-
-function parseUri (str) {
-  var o   = parseUri.options,
-    m   = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
-    uri = {},
-    i   = 14;
-
-  while (i--) uri[o.key[i]] = m[i] || "";
-
-  uri[o.q.name] = {};
-  uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) {
-    if ($1) uri[o.q.name][$1] = $2;
-  });
-
-  return uri;
-};
-
-parseUri.options = {
-  strictMode: false,
-  key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],
-  q:   {
-    name:   "queryKey",
-    parser: /(?:^|&)([^&=]*)=?([^&]*)/g
-  },
-  parser: {
-    strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
-    loose:  /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
-  }
-};
-
-module.exports = parseUri;
-
-});
-
-require.define("events", function (require, module, exports, __dirname, __filename) {
-    if (!process.EventEmitter) process.EventEmitter = function () {};
-
-var EventEmitter = exports.EventEmitter = process.EventEmitter;
-var isArray = typeof Array.isArray === 'function'
-    ? Array.isArray
-    : function (xs) {
-        return Object.toString.call(xs) === '[object Array]'
-    }
-;
-
-// By default EventEmitters will print a warning if more than
-// 10 listeners are added to it. This is a useful default which
-// helps finding memory leaks.
-//
-// Obviously not all Emitters should be limited to 10. This function allows
-// that to be increased. Set to zero for unlimited.
-var defaultMaxListeners = 10;
-EventEmitter.prototype.setMaxListeners = function(n) {
-  if (!this._events) this._events = {};
-  this._events.maxListeners = n;
-};
-
-
-EventEmitter.prototype.emit = function(type) {
-  // If there is no 'error' event listener then throw.
-  if (type === 'error') {
-    if (!this._events || !this._events.error ||
-        (isArray(this._events.error) && !this._events.error.length))
-    {
-      if (arguments[1] instanceof Error) {
-        throw arguments[1]; // Unhandled 'error' event
-      } else {
-        throw new Error("Uncaught, unspecified 'error' event.");
-      }
-      return false;
-    }
-  }
-
-  if (!this._events) return false;
-  var handler = this._events[type];
-  if (!handler) return false;
-
-  if (typeof handler == 'function') {
-    switch (arguments.length) {
-      // fast cases
-      case 1:
-        handler.call(this);
-        break;
-      case 2:
-        handler.call(this, arguments[1]);
-        break;
-      case 3:
-        handler.call(this, arguments[1], arguments[2]);
-        break;
-      // slower
-      default:
-        var args = Array.prototype.slice.call(arguments, 1);
-        handler.apply(this, args);
-    }
-    return true;
-
-  } else if (isArray(handler)) {
-    var args = Array.prototype.slice.call(arguments, 1);
-
-    var listeners = handler.slice();
-    for (var i = 0, l = listeners.length; i < l; i++) {
-      listeners[i].apply(this, args);
-    }
-    return true;
-
-  } else {
-    return false;
-  }
-};
-
-// EventEmitter is defined in src/node_events.cc
-// EventEmitter.prototype.emit() is also defined there.
-EventEmitter.prototype.addListener = function(type, listener) {
-  if ('function' !== typeof listener) {
-    throw new Error('addListener only takes instances of Function');
-  }
-
-  if (!this._events) this._events = {};
-
-  // To avoid recursion in the case that type == "newListeners"! Before
-  // adding it to the listeners, first emit "newListeners".
-  this.emit('newListener', type, listener);
-
-  if (!this._events[type]) {
-    // Optimize the case of one listener. Don't need the extra array object.
-    this._events[type] = listener;
-  } else if (isArray(this._events[type])) {
-
-    // Check for listener leak
-    if (!this._events[type].warned) {
-      var m;
-      if (this._events.maxListeners !== undefined) {
-        m = this._events.maxListeners;
-      } else {
-        m = defaultMaxListeners;
-      }
-
-      if (m && m > 0 && this._events[type].length > m) {
-        this._events[type].warned = true;
-        console.error('(node) warning: possible EventEmitter memory ' +
-                      'leak detected. %d listeners added. ' +
-                      'Use emitter.setMaxListeners() to increase limit.',
-                      this._events[type].length);
-        console.trace();
-      }
-    }
-
-    // If we've already got an array, just append.
-    this._events[type].push(listener);
-  } else {
-    // Adding the second element, need to change to array.
-    this._events[type] = [this._events[type], listener];
-  }
-
-  return this;
-};
-
-EventEmitter.prototype.on = EventEmitter.prototype.addListener;
-
-EventEmitter.prototype.once = function(type, listener) {
-  var self = this;
-  self.on(type, function g() {
-    self.removeListener(type, g);
-    listener.apply(this, arguments);
-  });
-
-  return this;
-};
-
-EventEmitter.prototype.removeListener = function(type, listener) {
-  if ('function' !== typeof listener) {
-    throw new Error('removeListener only takes instances of Function');
-  }
-
-  // does not use listeners(), so no side effect of creating _events[type]
-  if (!this._events || !this._events[type]) return this;
-
-  var list = this._events[type];
-
-  if (isArray(list)) {
-    var i = list.indexOf(listener);
-    if (i < 0) return this;
-    list.splice(i, 1);
-    if (list.length == 0)
-      delete this._events[type];
-  } else if (this._events[type] === listener) {
-    delete this._events[type];
-  }
-
-  return this;
-};
-
-EventEmitter.prototype.removeAllListeners = function(type) {
-  // does not use listeners(), so no side effect of creating _events[type]
-  if (type && this._events && this._events[type]) this._events[type] = null;
-  return this;
-};
-
-EventEmitter.prototype.listeners = function(type) {
-  if (!this._events) this._events = {};
-  if (!this._events[type]) this._events[type] = [];
-  if (!isArray(this._events[type])) {
-    this._events[type] = [this._events[type]];
-  }
-  return this._events[type];
-};
-
-});
-
-require.define("/node_modules/sprintf/package.json", function (require, module, exports, __dirname, __filename) {
-    module.exports = {"main":"./lib/sprintf"}
-});
-
-require.define("/node_modules/sprintf/lib/sprintf.js", function (require, module, exports, __dirname, __filename) {
-    /**
-sprintf() for JavaScript 0.7-beta1
-http://www.diveintojavascript.com/projects/javascript-sprintf
-
-Copyright (c) Alexandru Marasteanu <alexaholic [at) gmail (dot] com>
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above copyright
-      notice, this list of conditions and the following disclaimer in the
-      documentation and/or other materials provided with the distribution.
-    * Neither the name of sprintf() for JavaScript nor the
-      names of its contributors may be used to endorse or promote products
-      derived from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL Alexandru Marasteanu BE LIABLE FOR ANY
-DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-Changelog:
-2010.11.07 - 0.7-beta1-node
-  - converted it to a node.js compatible module
-
-2010.09.06 - 0.7-beta1
-  - features: vsprintf, support for named placeholders
-  - enhancements: format cache, reduced global namespace pollution
-
-2010.05.22 - 0.6:
- - reverted to 0.4 and fixed the bug regarding the sign of the number 0
- Note:
- Thanks to Raphael Pigulla <raph (at] n3rd [dot) org> (http://www.n3rd.org/)
- who warned me about a bug in 0.5, I discovered that the last update was
- a regress. I appologize for that.
-
-2010.05.09 - 0.5:
- - bug fix: 0 is now preceeded with a + sign
- - bug fix: the sign was not at the right position on padded results (Kamal Abdali)
- - switched from GPL to BSD license
-
-2007.10.21 - 0.4:
- - unit test and patch (David Baird)
-
-2007.09.17 - 0.3:
- - bug fix: no longer throws exception on empty paramenters (Hans Pufal)
-
-2007.09.11 - 0.2:
- - feature: added argument swapping
-
-2007.04.03 - 0.1:
- - initial release
-**/
-
-var sprintf = (function() {
-  function get_type(variable) {
-    return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase();
-  }
-  function str_repeat(input, multiplier) {
-    for (var output = []; multiplier > 0; output[--multiplier] = input) {/* do nothing */}
-    return output.join('');
-  }
-
-  var str_format = function() {
-    if (!str_format.cache.hasOwnProperty(arguments[0])) {
-      str_format.cache[arguments[0]] = str_format.parse(arguments[0]);
-    }
-    return str_format.format.call(null, str_format.cache[arguments[0]], arguments);
-  };
-
-  str_format.format = function(parse_tree, argv) {
-    var cursor = 1, tree_length = parse_tree.length, node_type = '', arg, output = [], i, k, match, pad, pad_character, pad_length;
-    for (i = 0; i < tree_length; i++) {
-      node_type = get_type(parse_tree[i]);
-      if (node_type === 'string') {
-        output.push(parse_tree[i]);
-      }
-      else if (node_type === 'array') {
-        match = parse_tree[i]; // convenience purposes only
-        if (match[2]) { // keyword argument
-          arg = argv[cursor];
-          for (k = 0; k < match[2].length; k++) {
-            if (!arg.hasOwnProperty(match[2][k])) {
-              throw(sprintf('[sprintf] property "%s" does not exist', match[2][k]));
-            }
-            arg = arg[match[2][k]];
-          }
-        }
-        else if (match[1]) { // positional argument (explicit)
-          arg = argv[match[1]];
-        }
-        else { // positional argument (implicit)
-          arg = argv[cursor++];
-        }
-
-        if (/[^s]/.test(match[8]) && (get_type(arg) != 'number')) {
-          throw(sprintf('[sprintf] expecting number but found %s', get_type(arg)));
-        }
-        switch (match[8]) {
-          case 'b': arg = arg.toString(2); break;
-          case 'c': arg = String.fromCharCode(arg); break;
-          case 'd': arg = parseInt(arg, 10); break;
-          case 'e': arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential(); break;
-          case 'f': arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg); break;
-          case 'o': arg = arg.toString(8); break;
-          case 's': arg = ((arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg); break;
-          case 'u': arg = Math.abs(arg); break;
-          case 'x': arg = arg.toString(16); break;
-          case 'X': arg = arg.toString(16).toUpperCase(); break;
-        }
-        arg = (/[def]/.test(match[8]) && match[3] && arg >= 0 ? '+'+ arg : arg);
-        pad_character = match[4] ? match[4] == '0' ? '0' : match[4].charAt(1) : ' ';
-        pad_length = match[6] - String(arg).length;
-        pad = match[6] ? str_repeat(pad_character, pad_length) : '';
-        output.push(match[5] ? arg + pad : pad + arg);
-      }
-    }
-    return output.join('');
-  };
-
-  str_format.cache = {};
-
-  str_format.parse = function(fmt) {
-    var _fmt = fmt, match = [], parse_tree = [], arg_names = 0;
-    while (_fmt) {
-      if ((match = /^[^\x25]+/.exec(_fmt)) !== null) {
-        parse_tree.push(match[0]);
-      }
-      else if ((match = /^\x25{2}/.exec(_fmt)) !== null) {
-        parse_tree.push('%');
-      }
-      else if ((match = /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(_fmt)) !== null) {
-        if (match[2]) {
-          arg_names |= 1;
-          var field_list = [], replacement_field = match[2], field_match = [];
-          if ((field_match = /^([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) {
-            field_list.push(field_match[1]);
-            while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') {
-              if ((field_match = /^\.([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) {
-                field_list.push(field_match[1]);
-              }
-              else if ((field_match = /^\[(\d+)\]/.exec(replacement_field)) !== null) {
-                field_list.push(field_match[1]);
-              }
-              else {
-                throw('[sprintf] huh?');
-              }
-            }
-          }
-          else {
-            throw('[sprintf] huh?');
-          }
-          match[2] = field_list;
-        }
-        else {
-          arg_names |= 2;
-        }
-        if (arg_names === 3) {
-          throw('[sprintf] mixing positional and named placeholders is not (yet) supported');
-        }
-        parse_tree.push(match);
-      }
-      else {
-        throw('[sprintf] huh?');
-      }
-      _fmt = _fmt.substring(match[0].length);
-    }
-    return parse_tree;
-  };
-
-  return str_format;
-})();
-
-var vsprintf = function(fmt, argv) {
-  argv.unshift(fmt);
-  return sprintf.apply(null, argv);
-};
-
-exports.sprintf = sprintf;
-exports.vsprintf = vsprintf;
-});
-
-require.define("/shred/response.js", function (require, module, exports, __dirname, __filename) {
-    // The `Response object` encapsulates a Node.js HTTP response.
-
-var Content = require("./content")
-  , HeaderMixins = require("./mixins/headers")
-  , CookieJarLib = require( "cookiejar" )
-  , Cookie = CookieJarLib.Cookie
-;
-
-// Browser doesn't have zlib.
-var zlib = null;
-try {
-  zlib = require('zlib');
-} catch (e) {
-  console.warn("no zlib library");
-}
-
-// Iconv doesn't work in browser
-var Iconv = null;
-try {
-  Iconv = require('iconv-lite');
-} catch (e) {
-  console.warn("no iconv library");
-}
-
-// Construct a `Response` object. You should never have to do this directly. The
-// `Request` object handles this, getting the raw response object and passing it
-// in here, along with the request. The callback allows us to stream the response
-// and then use the callback to let the request know when it's ready.
-var Response = function(raw, request, callback) { 
-  var response = this;
-  this._raw = raw;
-
-  // The `._setHeaders` method is "private"; you can't otherwise set headers on
-  // the response.
-  this._setHeaders.call(this,raw.headers);
-  
-  // store any cookies
-  if (request.cookieJar && this.getHeader('set-cookie')) {
-    var cookieStrings = this.getHeader('set-cookie');
-    var cookieObjs = []
-      , cookie;
-
-    for (var i = 0; i < cookieStrings.length; i++) {
-      var cookieString = cookieStrings[i];
-      if (!cookieString) {
-        continue;
-      }
-
-      if (!cookieString.match(/domain\=/i)) {
-        cookieString += '; domain=' + request.host;
-      }
-
-      if (!cookieString.match(/path\=/i)) {
-        cookieString += '; path=' + request.path;
-      }
-
-      try {
-        cookie = new Cookie(cookieString);
-        if (cookie) {
-          cookieObjs.push(cookie);
-        }
-      } catch (e) {
-        console.warn("Tried to set bad cookie: " + cookieString);
-      }
-    }
-
-    request.cookieJar.setCookies(cookieObjs);
-  }
-
-  this.request = request;
-  this.client = request.client;
-  this.log = this.request.log;
-
-  // Stream the response content entity and fire the callback when we're done.
-  // Store the incoming data in a array of Buffers which we concatinate into one
-  // buffer at the end.  We need to use buffers instead of strings here in order
-  // to preserve binary data.
-  var chunkBuffers = [];
-  var dataLength = 0;
-  raw.on("data", function(chunk) {
-    chunkBuffers.push(chunk);
-    dataLength += chunk.length;
-  });
-  raw.on("end", function() {
-    var body;
-    if (typeof Buffer === 'undefined') {
-      // Just concatinate into a string
-      body = chunkBuffers.join('');
-    } else {
-      // Initialize new buffer and add the chunks one-at-a-time.
-      body = new Buffer(dataLength);
-      for (var i = 0, pos = 0; i < chunkBuffers.length; i++) {
-        chunkBuffers[i].copy(body, pos);
-        pos += chunkBuffers[i].length;
-      }
-    }
-
-    var setBodyAndFinish = function (body) {
-      response._body = new Content({ 
-        body: body,
-        type: response.getHeader("Content-Type")
-      });
-      callback(response);
-    }
-
-    if (zlib && response.getHeader("Content-Encoding") === 'gzip'){
-      zlib.gunzip(body, function (err, gunzippedBody) {
-        if (Iconv && response.request.encoding){
-          body = Iconv.fromEncoding(gunzippedBody,response.request.encoding);
-        } else {
-          body = gunzippedBody.toString();
-        }
-        setBodyAndFinish(body);
-      })
-    }
-    else{
-       if (response.request.encoding){
-            body = Iconv.fromEncoding(body,response.request.encoding);
-        }        
-      setBodyAndFinish(body);
-    }
-  });
-};
-
-// The `Response` object can be pretty overwhelming to view using the built-in
-// Node.js inspect method. We want to make it a bit more manageable. This
-// probably goes [too far in the other
-// direction](https://github.com/spire-io/shred/issues/2).
-
-Response.prototype = {
-  inspect: function() {
-    var response = this;
-    var headers = this.format_headers();
-    var summary = ["<Shred Response> ", response.status].join(" ")
-    return [ summary, "- Headers:", headers].join("\n");
-  },
-  format_headers: function () {
-    var array = []
-    var headers = this._headers
-    for (var key in headers) {
-      if (headers.hasOwnProperty(key)) {
-        var value = headers[key]
-        array.push("\t" + key + ": " + value);
-      }
-    }
-    return array.join("\n");
-  }
-};
-
-// `Response` object properties, all of which are read-only:
-Object.defineProperties(Response.prototype, {
-  
-// - **status**. The HTTP status code for the response. 
-  status: {
-    get: function() { return this._raw.statusCode; },
-    enumerable: true
-  },
-
-// - **content**. The HTTP content entity, if any. Provided as a [content
-//   object](./content.html), which will attempt to convert the entity based upon
-//   the `content-type` header. The converted value is available as
-//   `content.data`. The original raw content entity is available as
-//   `content.body`.
-  body: {
-    get: function() { return this._body; }
-  },
-  content: {
-    get: function() { return this.body; },
-    enumerable: true
-  },
-
-// - **isRedirect**. Is the response a redirect? These are responses with 3xx
-//   status and a `Location` header.
-  isRedirect: {
-    get: function() {
-      return (this.status>299
-          &&this.status<400
-          &&this.getHeader("Location"));
-    },
-    enumerable: true
-  },
-
-// - **isError**. Is the response an error? These are responses with status of
-//   400 or greater.
-  isError: {
-    get: function() {
-      return (this.status === 0 || this.status > 399)
-    },
-    enumerable: true
-  }
-});
-
-// Add in the [getters for accessing the normalized headers](./headers.js).
-HeaderMixins.getters(Response);
-HeaderMixins.privateSetters(Response);
-
-// Work around Mozilla bug #608735 [https://bugzil.la/608735], which causes
-// getAllResponseHeaders() to return {} if the response is a CORS request.
-// xhr.getHeader still works correctly.
-var getHeader = Response.prototype.getHeader;
-Response.prototype.getHeader = function (name) {
-  return (getHeader.call(this,name) ||
-    (typeof this._raw.getHeader === 'function' && this._raw.getHeader(name)));
-};
-
-module.exports = Response;
-
-});
-
-require.define("/shred/content.js", function (require, module, exports, __dirname, __filename) {
-    
-// The purpose of the `Content` object is to abstract away the data conversions
-// to and from raw content entities as strings. For example, you want to be able
-// to pass in a Javascript object and have it be automatically converted into a
-// JSON string if the `content-type` is set to a JSON-based media type.
-// Conversely, you want to be able to transparently get back a Javascript object
-// in the response if the `content-type` is a JSON-based media-type.
-
-// One limitation of the current implementation is that it [assumes the `charset` is UTF-8](https://github.com/spire-io/shred/issues/5).
-
-// The `Content` constructor takes an options object, which *must* have either a
-// `body` or `data` property and *may* have a `type` property indicating the
-// media type. If there is no `type` attribute, a default will be inferred.
-var Content = function(options) {
-  this.body = options.body;
-  this.data = options.data;
-  this.type = options.type;
-};
-
-Content.prototype = {
-  // Treat `toString()` as asking for the `content.body`. That is, the raw content entity.
-  //
-  //     toString: function() { return this.body; }
-  //
-  // Commented out, but I've forgotten why. :/
-};
-
-
-// `Content` objects have the following attributes:
-Object.defineProperties(Content.prototype,{
-  
-// - **type**. Typically accessed as `content.type`, reflects the `content-type`
-//   header associated with the request or response. If not passed as an options
-//   to the constructor or set explicitly, it will infer the type the `data`
-//   attribute, if possible, and, failing that, will default to `text/plain`.
-  type: {
-    get: function() {
-      if (this._type) {
-        return this._type;
-      } else {
-        if (this._data) {
-          switch(typeof this._data) {
-            case "string": return "text/plain";
-            case "object": return "application/json";
-          }
-        }
-      }
-      return "text/plain";
-    },
-    set: function(value) {
-      this._type = value;
-      return this;
-    },
-    enumerable: true
-  },
-
-// - **data**. Typically accessed as `content.data`, reflects the content entity
-//   converted into Javascript data. This can be a string, if the `type` is, say,
-//   `text/plain`, but can also be a Javascript object. The conversion applied is
-//   based on the `processor` attribute. The `data` attribute can also be set
-//   directly, in which case the conversion will be done the other way, to infer
-//   the `body` attribute.
-  data: {
-    get: function() {
-      if (this._body) {
-        return this.processor.parser(this._body);
-      } else {
-        return this._data;
-      }
-    },
-    set: function(data) {
-      if (this._body&&data) Errors.setDataWithBody(this);
-      this._data = data;
-      return this;
-    },
-    enumerable: true
-  },
-
-// - **body**. Typically accessed as `content.body`, reflects the content entity
-//   as a UTF-8 string. It is the mirror of the `data` attribute. If you set the
-//   `data` attribute, the `body` attribute will be inferred and vice-versa. If
-//   you attempt to set both, an exception is raised.
-  body: {
-    get: function() {
-      if (this._data) {
-        return this.processor.stringify(this._data);
-      } else {
-        return this.processor.stringify(this._body);
-      }
-    },
-    set: function(body) {
-      if (this._data&&body) Errors.setBodyWithData(this);
-      this._body = body;
-      return this;
-    },
-    enumerable: true
-  },
-
-// - **processor**. The functions that will be used to convert to/from `data` and
-//   `body` attributes. You can add processors. The two that are built-in are for
-//   `text/plain`, which is basically an identity transformation and
-//   `application/json` and other JSON-based media types (including custom media
-//   types with `+json`). You can add your own processors. See below.
-  processor: {
-    get: function() {
-      var processor = Content.processors[this.type];
-      if (processor) {
-        return processor;
-      } else {
-        // Return the first processor that matches any part of the
-        // content type. ex: application/vnd.foobar.baz+json will match json.
-        var main = this.type.split(";")[0];
-        var parts = main.split(/\+|\//);
-        for (var i=0, l=parts.length; i < l; i++) {
-          processor = Content.processors[parts[i]]
-        }
-        return processor || {parser:identity,stringify:toString};
-      }
-    },
-    enumerable: true
-  },
-
-// - **length**. Typically accessed as `content.length`, returns the length in
-//   bytes of the raw content entity.
-  length: {
-    get: function() {
-      if (typeof Buffer !== 'undefined') {
-        return Buffer.byteLength(this.body);
-      }
-      return this.body.length;
-    }
-  }
-});
-
-Content.processors = {};
-
-// The `registerProcessor` function allows you to add your own processors to
-// convert content entities. Each processor consists of a Javascript object with
-// two properties:
-// - **parser**. The function used to parse a raw content entity and convert it
-//   into a Javascript data type.
-// - **stringify**. The function used to convert a Javascript data type into a
-//   raw content entity.
-Content.registerProcessor = function(types,processor) {
-  
-// You can pass an array of types that will trigger this processor, or just one.
-// We determine the array via duck-typing here.
-  if (types.forEach) {
-    types.forEach(function(type) {
-      Content.processors[type] = processor;
-    });
-  } else {
-    // If you didn't pass an array, we just use what you pass in.
-    Content.processors[types] = processor;
-  }
-};
-
-// Register the identity processor, which is used for text-based media types.
-var identity = function(x) { return x; }
-  , toString = function(x) { return x.toString(); }
-Content.registerProcessor(
-  ["text/html","text/plain","text"],
-  { parser: identity, stringify: toString });
-
-// Register the JSON processor, which is used for JSON-based media types.
-Content.registerProcessor(
-  ["application/json; charset=utf-8","application/json","json"],
-  {
-    parser: function(string) {
-      return JSON.parse(string);
-    },
-    stringify: function(data) {
-      return JSON.stringify(data); }});
-
-// Error functions are defined separately here in an attempt to make the code
-// easier to read.
-var Errors = {
-  setDataWithBody: function(object) {
-    throw new Error("Attempt to set data attribute of a content object " +
-        "when the body attributes was already set.");
-  },
-  setBodyWithData: function(object) {
-    throw new Error("Attempt to set body attribute of a content object " +
-        "when the data attributes was already set.");
-  }
-}
-module.exports = Content;
-
-});
-
-require.define("/shred/mixins/headers.js", function (require, module, exports, __dirname, __filename) {
-    // The header mixins allow you to add HTTP header support to any object. This
-// might seem pointless: why not simply use a hash? The main reason is that, per
-// the [HTTP spec](http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2),
-// headers are case-insensitive. So, for example, `content-type` is the same as
-// `CONTENT-TYPE` which is the same as `Content-Type`. Since there is no way to
-// overload the index operator in Javascript, using a hash to represent the
-// headers means it's possible to have two conflicting values for a single
-// header.
-// 
-// The solution to this is to provide explicit methods to set or get headers.
-// This also has the benefit of allowing us to introduce additional variations,
-// including snake case, which we automatically convert to what Matthew King has
-// dubbed "corset case" - the hyphen-separated names with initial caps:
-// `Content-Type`. We use corset-case just in case we're dealing with servers
-// that haven't properly implemented the spec.
-
-// Convert headers to corset-case. **Example:** `CONTENT-TYPE` will be converted
-// to `Content-Type`.
-
-var corsetCase = function(string) {
-  return string.toLowerCase()
-      //.replace("_","-")
-      .replace(/(^|-)(\w)/g, 
-          function(s) { return s.toUpperCase(); });
-};
-
-// We suspect that `initializeHeaders` was once more complicated ...
-var initializeHeaders = function(object) {
-  return {};
-};
-
-// Access the `_headers` property using lazy initialization. **Warning:** If you
-// mix this into an object that is using the `_headers` property already, you're
-// going to have trouble.
-var $H = function(object) {
-  return object._headers||(object._headers=initializeHeaders(object));
-};
-
-// Hide the implementations as private functions, separate from how we expose them.
-
-// The "real" `getHeader` function: get the header after normalizing the name.
-var getHeader = function(object,name) {
-  return $H(object)[corsetCase(name)];
-};
-
-// The "real" `getHeader` function: get one or more headers, or all of them
-// if you don't ask for any specifics. 
-var getHeaders = function(object,names) {
-  var keys = (names && names.length>0) ? names : Object.keys($H(object));
-  var hash = keys.reduce(function(hash,key) {
-    hash[key] = getHeader(object,key);
-    return hash;
-  },{});
-  // Freeze the resulting hash so you don't mistakenly think you're modifying
-  // the real headers.
-  Object.freeze(hash);
-  return hash;
-};
-
-// The "real" `setHeader` function: set a header, after normalizing the name.
-var setHeader = function(object,name,value) {
-  $H(object)[corsetCase(name)] = value;
-  return object;
-};
-
-// The "real" `setHeaders` function: set multiple headers based on a hash.
-var setHeaders = function(object,hash) {
-  for( var key in hash ) { setHeader(object,key,hash[key]); };
-  return this;
-};
-
-// Here's where we actually bind the functionality to an object. These mixins work by
-// exposing mixin functions. Each function mixes in a specific batch of features.
-module.exports = {
-  
-  // Add getters.
-  getters: function(constructor) {
-    constructor.prototype.getHeader = function(name) { return getHeader(this,name); };
-    constructor.prototype.getHeaders = function() { return getHeaders(this,arguments); };
-  },
-  // Add setters but as "private" methods.
-  privateSetters: function(constructor) {
-    constructor.prototype._setHeader = function(key,value) { return setHeader(this,key,value); };
-    constructor.prototype._setHeaders = function(hash) { return setHeaders(this,hash); };
-  },
-  // Add setters.
-  setters: function(constructor) {
-    constructor.prototype.setHeader = function(key,value) { return setHeader(this,key,value); };
-    constructor.prototype.setHeaders = function(hash) { return setHeaders(this,hash); };
-  },
-  // Add both getters and setters.
-  gettersAndSetters: function(constructor) {
-    constructor.prototype.getHeader = function(name) { return getHeader(this,name); };
-    constructor.prototype.getHeaders = function() { return getHeaders(this,arguments); };
-    constructor.prototype.setHeader = function(key,value) { return setHeader(this,key,value); };
-    constructor.prototype.setHeaders = function(hash) { return setHeaders(this,hash); };
-  },
-};
-
-});
-
-require.define("/node_modules/iconv-lite/package.json", function (require, module, exports, __dirname, __filename) {
-    module.exports = {}
-});
-
-require.define("/node_modules/iconv-lite/index.js", function (require, module, exports, __dirname, __filename) {
-    // Module exports
-var iconv = module.exports = {
-    toEncoding: function(str, encoding) {
-        return iconv.getCodec(encoding).toEncoding(str);
-    },
-    fromEncoding: function(buf, encoding) {
-        return iconv.getCodec(encoding).fromEncoding(buf);
-    },
-    
-    defaultCharUnicode: '�',
-    defaultCharSingleByte: '?',
-    
-    // Get correct codec for given encoding.
-    getCodec: function(encoding) {
-        var enc = encoding || "utf8";
-        var codecOptions = undefined;
-        while (1) {
-            if (getType(enc) === "String")
-                enc = enc.replace(/[- ]/g, "").toLowerCase();
-            var codec = iconv.encodings[enc];
-            var type = getType(codec);
-            if (type === "String") {
-                // Link to other encoding.
-                codecOptions = {originalEncoding: enc};
-                enc = codec;
-            }
-            else if (type === "Object" && codec.type != undefined) {
-                // Options for other encoding.
-                codecOptions = codec;
-                enc = codec.type;
-            } 
-            else if (type === "Function")
-                // Codec itself.
-                return codec(codecOptions);
-            else
-                throw new Error("Encoding not recognized: '" + encoding + "' (searched as: '"+enc+"')");
-        }
-    },
-    
-    // Define basic encodings
-    encodings: {
-        internal: function(options) {
-            return {
-                toEncoding: function(str) {
-                    return new Buffer(ensureString(str), options.originalEncoding);
-                },
-                fromEncoding: function(buf) {
-                    return ensureBuffer(buf).toString(options.originalEncoding);
-                }
-            };
-        },
-        utf8: "internal",
-        ucs2: "internal",
-        binary: "internal",
-        ascii: "internal",
-        base64: "internal",
-        
-        // Codepage single-byte encodings.
-        singlebyte: function(options) {
-            // Prepare chars if needed
-            if (!options.chars || (options.chars.length !== 128 && options.chars.length !== 256))
-                throw new Error("Encoding '"+options.type+"' has incorrect 'chars' (must be of len 128 or 256)");
-            
-            if (options.chars.length === 128)
-                options.chars = asciiString + options.chars;
-            
-            if (!options.charsBuf) {
-                options.charsBuf = new Buffer(options.chars, 'ucs2');
-            }
-            
-            if (!options.revCharsBuf) {
-                options.revCharsBuf = new Buffer(65536);
-                var defChar = iconv.defaultCharSingleByte.charCodeAt(0);
-                for (var i = 0; i < options.revCharsBuf.length; i++)
-                    options.revCharsBuf[i] = defChar;
-                for (var i = 0; i < options.chars.length; i++)
-                    options.revCharsBuf[options.chars.charCodeAt(i)] = i;
-            }
-            
-            return {
-                toEncoding: function(str) {
-                    str = ensureString(str);
-                    
-                    var buf = new Buffer(str.length);
-                    var revCharsBuf = options.revCharsBuf;
-                    for (var i = 0; i < str.length; i++)
-                        buf[i] = revCharsBuf[str.charCodeAt(i)];
-                    
-                    return buf;
-                },
-                fromEncoding: function(buf) {
-                    buf = ensureBuffer(buf);
-                    
-                    // Strings are immutable in JS -> we use ucs2 buffer to speed up computations.
-                    var charsBuf = options.charsBuf;
-                    var newBuf = new Buffer(buf.length*2);
-                    var idx1 = 0, idx2 = 0;
-                    for (var i = 0, _len = buf.length; i < _len; i++) {
-                        idx1 = buf[i]*2; idx2 = i*2;
-                        newBuf[idx2] = charsBuf[idx1];
-                        newBuf[idx2+1] = charsBuf[idx1+1];
-                    }
-                    return newBuf.toString('ucs2');
-                }
-            };
-        },
-
-        // Codepage double-byte encodings.
-        table: function(options) {
-            var table = options.table, key, revCharsTable = options.revCharsTable;
-            if (!table) {
-                throw new Error("Encoding '" + options.type +"' has incorect 'table' option");
-            }
-            if(!revCharsTable) {
-                revCharsTable = options.revCharsTable = {};
-                for (key in table) {
-                    revCharsTable[table[key]] = parseInt(key);
-                }
-            }
-            
-            return {
-                toEncoding: function(str) {
-                    str = ensureString(str);
-                    var strLen = str.length;
-                    var bufLen = strLen;
-                    for (var i = 0; i < strLen; i++)
-                        if (str.charCodeAt(i) >> 7)
-                            bufLen++;
-
-                    var newBuf = new Buffer(bufLen), gbkcode, unicode, 
-                        defaultChar = revCharsTable[iconv.defaultCharUnicode.charCodeAt(0)];
-
-                    for (var i = 0, j = 0; i < strLen; i++) {
-                        unicode = str.charCodeAt(i);
-                        if (unicode >> 7) {
-                            gbkcode = revCharsTable[unicode] || defaultChar;
-                            newBuf[j++] = gbkcode >> 8; //high byte;
-                            newBuf[j++] = gbkcode & 0xFF; //low byte
-                        } else {//ascii
-                            newBuf[j++] = unicode;
-                        }
-                    }
-                    return newBuf;
-                },
-                fromEncoding: function(buf) {
-                    buf = ensureBuffer(buf);
-                    var bufLen = buf.length, strLen = 0;
-                    for (var i = 0; i < bufLen; i++) {
-                        strLen++;
-                        if (buf[i] & 0x80) //the high bit is 1, so this byte is gbkcode's high byte.skip next byte
-                            i++;
-                    }
-                    var newBuf = new Buffer(strLen*2), unicode, gbkcode,
-                        defaultChar = iconv.defaultCharUnicode.charCodeAt(0);
-                    
-                    for (var i = 0, j = 0; i < bufLen; i++, j+=2) {
-                        gbkcode = buf[i];
-                        if (gbkcode & 0x80) {
-                            gbkcode = (gbkcode << 8) + buf[++i];
-                            unicode = table[gbkcode] || defaultChar;
-                        } else {
-                            unicode = gbkcode;
-                        }
-                        newBuf[j] = unicode & 0xFF; //low byte
-                        newBuf[j+1] = unicode >> 8; //high byte
-                    }
-                    return newBuf.toString('ucs2');
-                }
-            }
-        }
-    }
-};
-
-// Add aliases to convert functions
-iconv.encode = iconv.toEncoding;
-iconv.decode = iconv.fromEncoding;
-
-// Load other encodings from files in /encodings dir.
-var encodingsDir = __dirname+"/encodings/",
-    fs = require('fs');
-fs.readdirSync(encodingsDir).forEach(function(file) {
-    if(fs.statSync(encodingsDir + file).isDirectory()) return;
-    var encodings = require(encodingsDir + file)
-    for (var key in encodings)
-        iconv.encodings[key] = encodings[key]
-});
-
-// Utilities
-var asciiString = '\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f'+
-              ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f';
-
-var ensureBuffer = function(buf) {
-    buf = buf || new Buffer(0);
-    return (buf instanceof Buffer) ? buf : new Buffer(buf.toString(), "utf8");
-}
-
-var ensureString = function(str) {
-    str = str || "";
-    return (str instanceof String) ? str : str.toString((str instanceof Buffer) ? 'utf8' : undefined);
-}
-
-var getType = function(obj) {
-    return Object.prototype.toString.call(obj).slice(8, -1);
-}
-
-
-});
-
-require.define("/node_modules/http-browserify/package.json", function (require, module, exports, __dirname, __filename) {
-    module.exports = {"main":"index.js","browserify":"browser.js"}
-});
-
-require.define("/node_modules/http-browserify/browser.js", function (require, module, exports, __dirname, __filename) {
-    var http = module.exports;
-var EventEmitter = require('events').EventEmitter;
-var Request = require('./lib/request');
-
-http.request = function (params, cb) {
-    if (!params) params = {};
-    if (!params.host) params.host = window.location.host.split(':')[0];
-    if (!params.port) params.port = window.location.port;
-    
-    var req = new Request(new xhrHttp, params);
-    if (cb) req.on('response', cb);
-    return req;
-};
-
-http.get = function (params, cb) {
-    params.method = 'GET';
-    var req = http.request(params, cb);
-    req.end();
-    return req;
-};
-
-var xhrHttp = (function () {
-    if (typeof window === 'undefined') {
-        throw new Error('no window object present');
-    }
-    else if (window.XMLHttpRequest) {
-        return window.XMLHttpRequest;
-    }
-    else if (window.ActiveXObject) {
-        var axs = [
-            'Msxml2.XMLHTTP.6.0',
-            'Msxml2.XMLHTTP.3.0',
-            'Microsoft.XMLHTTP'
-        ];
-        for (var i = 0; i < axs.length; i++) {
-            try {
-                var ax = new(window.ActiveXObject)(axs[i]);
-                return function () {
-                    if (ax) {
-                        var ax_ = ax;
-                        ax = null;
-                        return ax_;
-                    }
-                    else {
-                        return new(window.ActiveXObject)(axs[i]);
-                    }
-                };
-            }
-            catch (e) {}
-        }
-        throw new Error('ajax not supported in this browser')
-    }
-    else {
-        throw new Error('ajax not supported in this browser');
-    }
-})();
-
-http.STATUS_CODES = {
-    100 : 'Continue',
-    101 : 'Switching Protocols',
-    102 : 'Processing', // RFC 2518, obsoleted by RFC 4918
-    200 : 'OK',
-    201 : 'Created',
-    202 : 'Accepted',
-    203 : 'Non-Authoritative Information',
-    204 : 'No Content',
-    205 : 'Reset Content',
-    206 : 'Partial Content',
-    207 : 'Multi-Status', // RFC 4918
-    300 : 'Multiple Choices',
-    301 : 'Moved Permanently',
-    302 : 'Moved Temporarily',
-    303 : 'See Other',
-    304 : 'Not Modified',
-    305 : 'Use Proxy',
-    307 : 'Temporary Redirect',
-    400 : 'Bad Request',
-    401 : 'Unauthorized',
-    402 : 'Payment Required',
-    403 : 'Forbidden',
-    404 : 'Not Found',
-    405 : 'Method Not Allowed',
-    406 : 'Not Acceptable',
-    407 : 'Proxy Authentication Required',
-    408 : 'Request Time-out',
-    409 : 'Conflict',
-    410 : 'Gone',
-    411 : 'Length Required',
-    412 : 'Precondition Failed',
-    413 : 'Request Entity Too Large',
-    414 : 'Request-URI Too Large',
-    415 : 'Unsupported Media Type',
-    416 : 'Requested Range Not Satisfiable',
-    417 : 'Expectation Failed',
-    418 : 'I\'m a teapot', // RFC 2324
-    422 : 'Unprocessable Entity', // RFC 4918
-    423 : 'Locked', // RFC 4918
-    424 : 'Failed Dependency', // RFC 4918
-    425 : 'Unordered Collection', // RFC 4918
-    426 : 'Upgrade Required', // RFC 2817
-    500 : 'Internal Server Error',
-    501 : 'Not Implemented',
-    502 : 'Bad Gateway',
-    503 : 'Service Unavailable',
-    504 : 'Gateway Time-out',
-    505 : 'HTTP Version not supported',
-    506 : 'Variant Also Negotiates', // RFC 2295
-    507 : 'Insufficient Storage', // RFC 4918
-    509 : 'Bandwidth Limit Exceeded',
-    510 : 'Not Extended' // RFC 2774
-};
-
-});
-
-require.define("/node_modules/http-browserify/lib/request.js", function (require, module, exports, __dirname, __filename) {
-    var EventEmitter = require('events').EventEmitter;
-var Response = require('./response');
-var isSafeHeader = require('./isSafeHeader');
-
-var Request = module.exports = function (xhr, params) {
-    var self = this;
-    self.xhr = xhr;
-    self.body = '';
-    
-    var uri = params.host + ':' + params.port + (params.path || '/');
-    
-    xhr.open(
-        params.method || 'GET',
-        (params.scheme || 'http') + '://' + uri,
-        true
-    );
-    
-    if (params.headers) {
-        Object.keys(params.headers).forEach(function (key) {
-            if (!isSafeHeader(key)) return;
-            var value = params.headers[key];
-            if (Array.isArray(value)) {
-                value.forEach(function (v) {
-                    xhr.setRequestHeader(key, v);
-                });
-            }
-            else xhr.setRequestHeader(key, value)
-        });
-    }
-    
-    var res = new Response(xhr);
-    res.on('ready', function () {
-        self.emit('response', res);
-    });
-    
-    xhr.onreadystatechange = function () {
-        res.handle(xhr);
-    };
-};
-
-Request.prototype = new EventEmitter;
-
-Request.prototype.setHeader = function (key, value) {
-    if ((Array.isArray && Array.isArray(value))
-    || value instanceof Array) {
-        for (var i = 0; i < value.length; i++) {
-            this.xhr.setRequestHeader(key, value[i]);
-        }
-    }
-    else {
-        this.xhr.setRequestHeader(key, value);
-    }
-};
-
-Request.prototype.write = function (s) {
-    this.body += s;
-};
-
-Request.prototype.end = function (s) {
-    if (s !== undefined) this.write(s);
-    this.xhr.send(this.body);
-};
-
-});
-
-require.define("/node_modules/http-browserify/lib/response.js", function (require, module, exports, __dirname, __filename) {
-    var EventEmitter = require('events').EventEmitter;
-var isSafeHeader = require('./isSafeHeader');
-
-var Response = module.exports = function (xhr) {
-    this.xhr = xhr;
-    this.offset = 0;
-};
-
-Response.prototype = new EventEmitter;
-
-var capable = {
-    streaming : true,
-    status2 : true
-};
-
-function parseHeaders (xhr) {
-    var lines = xhr.getAllResponseHeaders().split(/\r?\n/);
-    var headers = {};
-    for (var i = 0; i < lines.length; i++) {
-        var line = lines[i];
-        if (line === '') continue;
-        
-        var m = line.match(/^([^:]+):\s*(.*)/);
-        if (m) {
-            var key = m[1].toLowerCase(), value = m[2];
-            
-            if (headers[key] !== undefined) {
-                if ((Array.isArray && Array.isArray(headers[key]))
-                || headers[key] instanceof Array) {
-                    headers[key].push(value);
-                }
-                else {
-                    headers[key] = [ headers[key], value ];
-                }
-            }
-            else {
-                headers[key] = value;
-            }
-        }
-        else {
-            headers[line] = true;
-        }
-    }
-    return headers;
-}
-
-Response.prototype.getHeader = function (key) {
-    var header = this.headers ? this.headers[key.toLowerCase()] : null;
-    if (header) return header;
-
-    // Work around Mozilla bug #608735 [https://bugzil.la/608735], which causes
-    // getAllResponseHeaders() to return {} if the response is a CORS request.
-    // xhr.getHeader still works correctly.
-    if (isSafeHeader(key)) {
-      return this.xhr.getResponseHeader(key);
-    }
-    return null;
-};
-
-Response.prototype.handle = function () {
-    var xhr = this.xhr;
-    if (xhr.readyState === 2 && capable.status2) {
-        try {
-            this.statusCode = xhr.status;
-            this.headers = parseHeaders(xhr);
-        }
-        catch (err) {
-            capable.status2 = false;
-        }
-        
-        if (capable.status2) {
-            this.emit('ready');
-        }
-    }
-    else if (capable.streaming && xhr.readyState === 3) {
-        try {
-            if (!this.statusCode) {
-                this.statusCode = xhr.status;
-                this.headers = parseHeaders(xhr);
-                this.emit('ready');
-            }
-        }
-        catch (err) {}
-        
-        try {
-            this.write();
-        }
-        catch (err) {
-            capable.streaming = false;
-        }
-    }
-    else if (xhr.readyState === 4) {
-        if (!this.statusCode) {
-            this.statusCode = xhr.status;
-            this.emit('ready');
-        }
-        this.write();
-        
-        if (xhr.error) {
-            this.emit('error', xhr.responseText);
-        }
-        else this.emit('end');
-    }
-};
-
-Response.prototype.write = function () {
-    var xhr = this.xhr;
-    if (xhr.responseText.length > this.offset) {
-        this.emit('data', xhr.responseText.slice(this.offset));
-        this.offset = xhr.responseText.length;
-    }
-};
-
-});
-
-require.define("/node_modules/http-browserify/lib/isSafeHeader.js", function (require, module, exports, __dirname, __filename) {
-    // Taken from http://dxr.mozilla.org/mozilla/mozilla-central/content/base/src/nsXMLHttpRequest.cpp.html
-var unsafeHeaders = [
-    "accept-charset",
-    "accept-encoding",
-    "access-control-request-headers",
-    "access-control-request-method",
-    "connection",
-    "content-length",
-    "cookie",
-    "cookie2",
-    "content-transfer-encoding",
-    "date",
-    "expect",
-    "host",
-    "keep-alive",
-    "origin",
-    "referer",
-    "set-cookie",
-    "te",
-    "trailer",
-    "transfer-encoding",
-    "upgrade",
-    "user-agent",
-    "via"
-];
-
-module.exports = function (headerName) {
-    if (!headerName) return false;
-    return (unsafeHeaders.indexOf(headerName.toLowerCase()) === -1)
-};
-
-});
-
-require.alias("http-browserify", "/node_modules/http");
-
-require.alias("http-browserify", "/node_modules/https");

+ 0 - 193
htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/shred/content.js

@@ -1,193 +0,0 @@
-
-// The purpose of the `Content` object is to abstract away the data conversions
-// to and from raw content entities as strings. For example, you want to be able
-// to pass in a Javascript object and have it be automatically converted into a
-// JSON string if the `content-type` is set to a JSON-based media type.
-// Conversely, you want to be able to transparently get back a Javascript object
-// in the response if the `content-type` is a JSON-based media-type.
-
-// One limitation of the current implementation is that it [assumes the `charset` is UTF-8](https://github.com/spire-io/shred/issues/5).
-
-// The `Content` constructor takes an options object, which *must* have either a
-// `body` or `data` property and *may* have a `type` property indicating the
-// media type. If there is no `type` attribute, a default will be inferred.
-var Content = function(options) {
-  this.body = options.body;
-  this.data = options.data;
-  this.type = options.type;
-};
-
-Content.prototype = {
-  // Treat `toString()` as asking for the `content.body`. That is, the raw content entity.
-  //
-  //     toString: function() { return this.body; }
-  //
-  // Commented out, but I've forgotten why. :/
-};
-
-
-// `Content` objects have the following attributes:
-Object.defineProperties(Content.prototype,{
-  
-// - **type**. Typically accessed as `content.type`, reflects the `content-type`
-//   header associated with the request or response. If not passed as an options
-//   to the constructor or set explicitly, it will infer the type the `data`
-//   attribute, if possible, and, failing that, will default to `text/plain`.
-  type: {
-    get: function() {
-      if (this._type) {
-        return this._type;
-      } else {
-        if (this._data) {
-          switch(typeof this._data) {
-            case "string": return "text/plain";
-            case "object": return "application/json";
-          }
-        }
-      }
-      return "text/plain";
-    },
-    set: function(value) {
-      this._type = value;
-      return this;
-    },
-    enumerable: true
-  },
-
-// - **data**. Typically accessed as `content.data`, reflects the content entity
-//   converted into Javascript data. This can be a string, if the `type` is, say,
-//   `text/plain`, but can also be a Javascript object. The conversion applied is
-//   based on the `processor` attribute. The `data` attribute can also be set
-//   directly, in which case the conversion will be done the other way, to infer
-//   the `body` attribute.
-  data: {
-    get: function() {
-      if (this._body) {
-        return this.processor.parser(this._body);
-      } else {
-        return this._data;
-      }
-    },
-    set: function(data) {
-      if (this._body&&data) Errors.setDataWithBody(this);
-      this._data = data;
-      return this;
-    },
-    enumerable: true
-  },
-
-// - **body**. Typically accessed as `content.body`, reflects the content entity
-//   as a UTF-8 string. It is the mirror of the `data` attribute. If you set the
-//   `data` attribute, the `body` attribute will be inferred and vice-versa. If
-//   you attempt to set both, an exception is raised.
-  body: {
-    get: function() {
-      if (this._data) {
-        return this.processor.stringify(this._data);
-      } else {
-        return this._body.toString();
-      }
-    },
-    set: function(body) {
-      if (this._data&&body) Errors.setBodyWithData(this);
-      this._body = body;
-      return this;
-    },
-    enumerable: true
-  },
-
-// - **processor**. The functions that will be used to convert to/from `data` and
-//   `body` attributes. You can add processors. The two that are built-in are for
-//   `text/plain`, which is basically an identity transformation and
-//   `application/json` and other JSON-based media types (including custom media
-//   types with `+json`). You can add your own processors. See below.
-  processor: {
-    get: function() {
-      var processor = Content.processors[this.type];
-      if (processor) {
-        return processor;
-      } else {
-        // Return the first processor that matches any part of the
-        // content type. ex: application/vnd.foobar.baz+json will match json.
-        var main = this.type.split(";")[0];
-        var parts = main.split(/\+|\//);
-        for (var i=0, l=parts.length; i < l; i++) {
-          processor = Content.processors[parts[i]]
-        }
-        return processor || {parser:identity,stringify:toString};
-      }
-    },
-    enumerable: true
-  },
-
-// - **length**. Typically accessed as `content.length`, returns the length in
-//   bytes of the raw content entity.
-  length: {
-    get: function() {
-      if (typeof Buffer !== 'undefined') {
-        return Buffer.byteLength(this.body);
-      }
-      return this.body.length;
-    }
-  }
-});
-
-Content.processors = {};
-
-// The `registerProcessor` function allows you to add your own processors to
-// convert content entities. Each processor consists of a Javascript object with
-// two properties:
-// - **parser**. The function used to parse a raw content entity and convert it
-//   into a Javascript data type.
-// - **stringify**. The function used to convert a Javascript data type into a
-//   raw content entity.
-Content.registerProcessor = function(types,processor) {
-  
-// You can pass an array of types that will trigger this processor, or just one.
-// We determine the array via duck-typing here.
-  if (types.forEach) {
-    types.forEach(function(type) {
-      Content.processors[type] = processor;
-    });
-  } else {
-    // If you didn't pass an array, we just use what you pass in.
-    Content.processors[types] = processor;
-  }
-};
-
-// Register the identity processor, which is used for text-based media types.
-var identity = function(x) { return x; }
-  , toString = function(x) { return x.toString(); }
-Content.registerProcessor(
-  ["text/html","text/plain","text"],
-  { parser: identity, stringify: toString });
-
-// Register the JSON processor, which is used for JSON-based media types.
-Content.registerProcessor(
-  ["application/json; charset=utf-8","application/json","json"],
-  {
-    parser: function(string) {
-      return JSON.parse(string);
-    },
-    stringify: function(data) {
-      return JSON.stringify(data); }});
-
-var qs = require('querystring');
-// Register the post processor, which is used for JSON-based media types.
-Content.registerProcessor(
-  ["application/x-www-form-urlencoded"],
-  { parser : qs.parse, stringify : qs.stringify });
-
-// Error functions are defined separately here in an attempt to make the code
-// easier to read.
-var Errors = {
-  setDataWithBody: function(object) {
-    throw new Error("Attempt to set data attribute of a content object " +
-        "when the body attributes was already set.");
-  },
-  setBodyWithData: function(object) {
-    throw new Error("Attempt to set body attribute of a content object " +
-        "when the data attributes was already set.");
-  }
-}
-module.exports = Content;

文件差异内容过多而无法显示
+ 0 - 338
htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/swagger-oauth.js


+ 0 - 1653
htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/swagger.js

@@ -1,1653 +0,0 @@
-// swagger.js
-// version 2.0.39
-
-var __bind = function(fn, me){
-  return function(){
-    return fn.apply(me, arguments);
-  };
-};
-
-log = function(){
-  log.history = log.history || [];
-  log.history.push(arguments);
-  if(this.console){
-    console.log( Array.prototype.slice.call(arguments)[0] );
-  }
-};
-
-// if you want to apply conditional formatting of parameter values
-parameterMacro = function(value) {
-  return value;
-}
-
-// if you want to apply conditional formatting of model property values
-modelPropertyMacro = function(value) {
-  return value;
-}
-
-if (!Array.prototype.indexOf) {
-  Array.prototype.indexOf = function(obj, start) {
-    for (var i = (start || 0), j = this.length; i < j; i++) {
-      if (this[i] === obj) { return i; }
-    }
-    return -1;
-  }
-}
-
-if (!('filter' in Array.prototype)) {
-  Array.prototype.filter= function(filter, that /*opt*/) {
-    var other= [], v;
-    for (var i=0, n= this.length; i<n; i++)
-      if (i in this && filter.call(that, v= this[i], i, this))
-        other.push(v);
-    return other;
-  };
-}
-
-if (!('map' in Array.prototype)) {
-  Array.prototype.map= function(mapper, that /*opt*/) {
-    var other= new Array(this.length);
-    for (var i= 0, n= this.length; i<n; i++)
-      if (i in this)
-        other[i]= mapper.call(that, this[i], i, this);
-    return other;
-  };
-}
-
-Object.keys = Object.keys || (function () {
-  var hasOwnProperty = Object.prototype.hasOwnProperty,
-    hasDontEnumBug = !{toString:null}.propertyIsEnumerable("toString"),
-    DontEnums = [
-      'toString',
-      'toLocaleString',
-      'valueOf',
-      'hasOwnProperty',
-      'isPrototypeOf',
-      'propertyIsEnumerable',
-      'constructor'
-    ],
-  DontEnumsLength = DontEnums.length;
-
-  return function (o) {
-    if (typeof o != "object" && typeof o != "function" || o === null)
-      throw new TypeError("Object.keys called on a non-object");
-
-    var result = [];
-    for (var name in o) {
-      if (hasOwnProperty.call(o, name))
-        result.push(name);
-    }
-
-    if (hasDontEnumBug) {
-      for (var i = 0; i < DontEnumsLength; i++) {
-        if (hasOwnProperty.call(o, DontEnums[i]))
-          result.push(DontEnums[i]);
-      }
-    }
-
-    return result;
-  };
-})();
-
-var SwaggerApi = function(url, options) {
-  this.isBuilt = false;
-  this.url = null;
-  this.debug = false;
-  this.basePath = null;
-  this.authorizations = null;
-  this.authorizationScheme = null;
-  this.info = null;
-  this.useJQuery = false;
-  this.modelsArray = [];
-
-  options = (options||{});
-  if (url)
-    if (url.url)
-      options = url;
-    else
-      this.url = url;
-  else
-    options = url;
-
-  if (options.url != null)
-    this.url = options.url;
-
-  if (options.success != null)
-    this.success = options.success;
-
-  if (typeof options.useJQuery === 'boolean')
-    this.useJQuery = options.useJQuery;
-
-  this.failure = options.failure != null ? options.failure : function() {};
-  this.progress = options.progress != null ? options.progress : function() {};
-  if (options.success != null) {
-    this.build();
-    this.isBuilt = true;
-  }
-}
-
-SwaggerApi.prototype.build = function() {
-  if(this.isBuilt)
-    return this;
-  var _this = this;
-  this.progress('fetching resource list: ' + this.url);
-  var obj = {
-    useJQuery: this.useJQuery,
-    url: this.url,
-    method: "get",
-    headers: {
-      accept: "application/json,application/json;charset=\"utf-8\",*/*"
-    },
-    on: {
-      error: function(response) {
-        if (_this.url.substring(0, 4) !== 'http') {
-          return _this.fail('Please specify the protocol for ' + _this.url);
-        } else if (response.status === 0) {
-          return _this.fail('Can\'t read from server.  It may not have the appropriate access-control-origin settings.');
-        } else if (response.status === 404) {
-          return _this.fail('Can\'t read swagger JSON from ' + _this.url);
-        } else {
-          return _this.fail(response.status + ' : ' + response.statusText + ' ' + _this.url);
-        }
-      },
-      response: function(resp) {
-        var responseObj = resp.obj || JSON.parse(resp.data);
-        _this.swaggerVersion = responseObj.swaggerVersion;
-        if (_this.swaggerVersion === "1.2") {
-          return _this.buildFromSpec(responseObj);
-        } else {
-          return _this.buildFrom1_1Spec(responseObj);
-        }
-      }
-    }
-  };
-  var e = (typeof window !== 'undefined' ? window : exports);
-  e.authorizations.apply(obj);
-  new SwaggerHttp().execute(obj);
-  return this;
-};
-
-SwaggerApi.prototype.buildFromSpec = function(response) {
-  if (response.apiVersion != null) {
-    this.apiVersion = response.apiVersion;
-  }
-  this.apis = {};
-  this.apisArray = [];
-  this.consumes = response.consumes;
-  this.produces = response.produces;
-  this.authSchemes = response.authorizations;
-  if (response.info != null) {
-    this.info = response.info;
-  }
-  var isApi = false;
-  var i;
-  for (i = 0; i < response.apis.length; i++) {
-    var api = response.apis[i];
-    if (api.operations) {
-      var j;
-      for (j = 0; j < api.operations.length; j++) {
-        operation = api.operations[j];
-        isApi = true;
-      }
-    }
-  }
-  if (response.basePath)
-    this.basePath = response.basePath;
-  else if (this.url.indexOf('?') > 0)
-    this.basePath = this.url.substring(0, this.url.lastIndexOf('?'));
-  else
-    this.basePath = this.url;
-
-  if (isApi) {
-    var newName = response.resourcePath.replace(/\//g, '');
-    this.resourcePath = response.resourcePath;
-    res = new SwaggerResource(response, this);
-    this.apis[newName] = res;
-    this.apisArray.push(res);
-  } else {
-    var k;
-    for (k = 0; k < response.apis.length; k++) {
-      var resource = response.apis[k];
-      res = new SwaggerResource(resource, this);
-      this.apis[res.name] = res;
-      this.apisArray.push(res);
-    }
-  }
-  if (this.success) {
-    this.success();
-  }
-  return this;
-};
-
-SwaggerApi.prototype.buildFrom1_1Spec = function(response) {
-  log("This API is using a deprecated version of Swagger!  Please see http://github.com/wordnik/swagger-core/wiki for more info");
-  if (response.apiVersion != null)
-    this.apiVersion = response.apiVersion;
-  this.apis = {};
-  this.apisArray = [];
-  this.produces = response.produces;
-  if (response.info != null) {
-    this.info = response.info;
-  }
-  var isApi = false;
-  for (var i = 0; i < response.apis.length; i++) {
-    var api = response.apis[i];
-    if (api.operations) {
-      for (var j = 0; j < api.operations.length; j++) {
-        operation = api.operations[j];
-        isApi = true;
-      }
-    }
-  }
-  if (response.basePath) {
-    this.basePath = response.basePath;
-  } else if (this.url.indexOf('?') > 0) {
-    this.basePath = this.url.substring(0, this.url.lastIndexOf('?'));
-  } else {
-    this.basePath = this.url;
-  }
-  if (isApi) {
-    var newName = response.resourcePath.replace(/\//g, '');
-    this.resourcePath = response.resourcePath;
-    var res = new SwaggerResource(response, this);
-    this.apis[newName] = res;
-    this.apisArray.push(res);
-  } else {
-    for (k = 0; k < response.apis.length; k++) {
-      resource = response.apis[k];
-      res = new SwaggerResource(resource, this);
-      this.apis[res.name] = res;
-      this.apisArray.push(res);
-    }
-  }
-  if (this.success) {
-    this.success();
-  }
-  return this;
-};
-
-SwaggerApi.prototype.selfReflect = function() {
-  var resource, resource_name, _ref;
-  if (this.apis == null) {
-    return false;
-  }
-  _ref = this.apis;
-  for (resource_name in _ref) {
-    resource = _ref[resource_name];
-    if (resource.ready == null) {
-      return false;
-    }
-  }
-  this.setConsolidatedModels();
-  this.ready = true;
-  if (this.success != null) {
-    return this.success();
-  }
-};
-
-SwaggerApi.prototype.fail = function(message) {
-  this.failure(message);
-  throw message;
-};
-
-SwaggerApi.prototype.setConsolidatedModels = function() {
-  var model, modelName, resource, resource_name, _i, _len, _ref, _ref1, _results;
-  this.models = {};
-  _ref = this.apis;
-  for (resource_name in _ref) {
-    resource = _ref[resource_name];
-    for (modelName in resource.models) {
-      if (this.models[modelName] == null) {
-        this.models[modelName] = resource.models[modelName];
-        this.modelsArray.push(resource.models[modelName]);
-      }
-    }
-  }
-  _ref1 = this.modelsArray;
-  _results = [];
-  for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
-    model = _ref1[_i];
-    _results.push(model.setReferencedModels(this.models));
-  }
-  return _results;
-};
-
-SwaggerApi.prototype.help = function() {
-  var operation, operation_name, parameter, resource, resource_name, _i, _len, _ref, _ref1, _ref2;
-  _ref = this.apis;
-  for (resource_name in _ref) {
-    resource = _ref[resource_name];
-    log(resource_name);
-    _ref1 = resource.operations;
-    for (operation_name in _ref1) {
-      operation = _ref1[operation_name];
-      log("  " + operation.nickname);
-      _ref2 = operation.parameters;
-      for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
-        parameter = _ref2[_i];
-        log("    " + parameter.name + (parameter.required ? ' (required)' : '') + " - " + parameter.description);
-      }
-    }
-  }
-  return this;
-};
-
-var SwaggerResource = function(resourceObj, api) {
-  var _this = this;
-  this.api = api;
-  this.api = this.api;
-  consumes = (this.consumes | []);
-  produces = (this.produces | []);
-  this.path = this.api.resourcePath != null ? this.api.resourcePath : resourceObj.path;
-  this.description = resourceObj.description;
-
-  var parts = this.path.split("/");
-  this.name = parts[parts.length - 1].replace('.{format}', '');
-  this.basePath = this.api.basePath;
-  this.operations = {};
-  this.operationsArray = [];
-  this.modelsArray = [];
-  this.models = {};
-  this.rawModels = {};
-  this.useJQuery = (typeof api.useJQuery !== 'undefined' ? api.useJQuery : null);
-
-  if ((resourceObj.apis != null) && (this.api.resourcePath != null)) {
-    this.addApiDeclaration(resourceObj);
-  } else {
-    if (this.path == null) {
-      this.api.fail("SwaggerResources must have a path.");
-    }
-    if (this.path.substring(0, 4) === 'http') {
-      this.url = this.path.replace('{format}', 'json');
-    } else {
-      this.url = this.api.basePath + this.path.replace('{format}', 'json');
-    }
-    this.api.progress('fetching resource ' + this.name + ': ' + this.url);
-    obj = {
-      url: this.url,
-      method: "get",
-      useJQuery: this.useJQuery,
-      headers: {
-        accept: "application/json,application/json;charset=\"utf-8\",*/*"
-      },
-      on: {
-        response: function(resp) {
-          var responseObj = resp.obj || JSON.parse(resp.data);
-          return _this.addApiDeclaration(responseObj);
-        },
-        error: function(response) {
-          return _this.api.fail("Unable to read api '" +
-            _this.name + "' from path " + _this.url + " (server returned " + response.statusText + ")");
-        }
-      }
-    };
-    var e = typeof window !== 'undefined' ? window : exports;
-    e.authorizations.apply(obj);
-    new SwaggerHttp().execute(obj);
-  }
-}
-
-SwaggerResource.prototype.getAbsoluteBasePath = function (relativeBasePath) {
-  var pos, url;
-  url = this.api.basePath;
-  pos = url.lastIndexOf(relativeBasePath);
-  var parts = url.split("/");
-  var rootUrl = parts[0] + "//" + parts[2];
-
-  if(relativeBasePath.indexOf("http") === 0)
-    return relativeBasePath;
-  if(relativeBasePath === "/")
-    return rootUrl;
-  if(relativeBasePath.substring(0, 1) == "/") {
-    // use root + relative
-    return rootUrl + relativeBasePath;
-  }
-  else {
-    var pos = this.basePath.lastIndexOf("/");
-    var base = this.basePath.substring(0, pos);
-    if(base.substring(base.length - 1) == "/")
-      return base + relativeBasePath;
-    else
-      return base + "/" + relativeBasePath;
-  }
-};
-
-SwaggerResource.prototype.addApiDeclaration = function(response) {
-  if (response.produces != null)
-    this.produces = response.produces;
-  if (response.consumes != null)
-    this.consumes = response.consumes;
-  if ((response.basePath != null) && response.basePath.replace(/\s/g, '').length > 0)
-    this.basePath = response.basePath.indexOf("http") === -1 ? this.getAbsoluteBasePath(response.basePath) : response.basePath;
-
-  this.addModels(response.models);
-  if (response.apis) {
-    for (var i = 0 ; i < response.apis.length; i++) {
-      var endpoint = response.apis[i];
-      this.addOperations(endpoint.path, endpoint.operations, response.consumes, response.produces);
-    }
-  }
-  this.api[this.name] = this;
-  this.ready = true;
-  return this.api.selfReflect();
-};
-
-SwaggerResource.prototype.addModels = function(models) {
-  if (models != null) {
-    var modelName;
-    for (modelName in models) {
-      if (this.models[modelName] == null) {
-        var swaggerModel = new SwaggerModel(modelName, models[modelName]);
-        this.modelsArray.push(swaggerModel);
-        this.models[modelName] = swaggerModel;
-        this.rawModels[modelName] = models[modelName];
-      }
-    }
-    var output = [];
-    for (var i = 0; i < this.modelsArray.length; i++) {
-      model = this.modelsArray[i];
-      output.push(model.setReferencedModels(this.models));
-    }
-    return output;
-  }
-};
-
-SwaggerResource.prototype.addOperations = function(resource_path, ops, consumes, produces) {
-  if (ops) {
-    output = [];
-    for (var i = 0; i < ops.length; i++) {
-      o = ops[i];
-      consumes = this.consumes;
-      produces = this.produces;
-      if (o.consumes != null)
-        consumes = o.consumes;
-      else
-        consumes = this.consumes;
-
-      if (o.produces != null)
-        produces = o.produces;
-      else
-        produces = this.produces;
-      type = (o.type||o.responseClass);
-
-      if (type === "array") {
-        ref = null;
-        if (o.items)
-          ref = o.items["type"] || o.items["$ref"];
-        type = "array[" + ref + "]";
-      }
-      responseMessages = o.responseMessages;
-      method = o.method;
-      if (o.httpMethod) {
-        method = o.httpMethod;
-      }
-      if (o.supportedContentTypes) {
-        consumes = o.supportedContentTypes;
-      }
-      if (o.errorResponses) {
-        responseMessages = o.errorResponses;
-        for (var j = 0; j < responseMessages.length; j++) {
-          r = responseMessages[j];
-          r.message = r.reason;
-          r.reason = null;
-        }
-      }
-      o.nickname = this.sanitize(o.nickname);
-      op = new SwaggerOperation(o.nickname, resource_path, method, o.parameters, o.summary, o.notes, type, responseMessages, this, consumes, produces, o.authorizations);
-      this.operations[op.nickname] = op;
-      output.push(this.operationsArray.push(op));
-    }
-    return output;
-  }
-};
-
-SwaggerResource.prototype.sanitize = function(nickname) {
-  var op;
-  op = nickname.replace(/[\s!@#$%^&*()_+=\[{\]};:<>|.\/?,\\'""-]/g, '_');
-  op = op.replace(/((_){2,})/g, '_');
-  op = op.replace(/^(_)*/g, '');
-  op = op.replace(/([_])*$/g, '');
-  return op;
-};
-
-SwaggerResource.prototype.help = function() {
-  var op = this.operations;
-  var output = [];
-  var operation_name;
-  for (operation_name in op) {
-    operation = op[operation_name];
-    var msg = "  " + operation.nickname;
-    for (var i = 0; i < operation.parameters; i++) {
-      parameter = operation.parameters[i];
-      msg.concat("    " + parameter.name + (parameter.required ? ' (required)' : '') + " - " + parameter.description);
-    }
-    output.push(msg);
-  }
-  return output;
-};
-
-var SwaggerModel = function(modelName, obj) {
-  this.name = obj.id != null ? obj.id : modelName;
-  this.properties = [];
-  var propertyName;
-  for (propertyName in obj.properties) {
-    if (obj.required != null) {
-      var value;
-      for (value in obj.required) {
-        if (propertyName === obj.required[value]) {
-          obj.properties[propertyName].required = true;
-        }
-      }
-    }
-    prop = new SwaggerModelProperty(propertyName, obj.properties[propertyName]);
-    this.properties.push(prop);
-  }
-}
-
-SwaggerModel.prototype.setReferencedModels = function(allModels) {
-  var results = [];
-  for (var i = 0; i < this.properties.length; i++) {
-    var property = this.properties[i];
-    var type = property.type || property.dataType;
-    if (allModels[type] != null)
-      results.push(property.refModel = allModels[type]);
-    else if ((property.refDataType != null) && (allModels[property.refDataType] != null))
-      results.push(property.refModel = allModels[property.refDataType]);
-    else
-      results.push(void 0);
-  }
-  return results;
-};
-
-SwaggerModel.prototype.getMockSignature = function(modelsToIgnore) {
-  var propertiesStr = [];
-  for (var i = 0; i < this.properties.length; i++) {
-    prop = this.properties[i];
-    propertiesStr.push(prop.toString());
-  }
-
-  var strong = '<span class="strong">';
-  var stronger = '<span class="stronger">';
-  var strongClose = '</span>';
-  var classOpen = strong + this.name + ' {' + strongClose;
-  var classClose = strong + '}' + strongClose;
-  var returnVal = classOpen + '<div>' + propertiesStr.join(',</div><div>') + '</div>' + classClose;
-  if (!modelsToIgnore)
-    modelsToIgnore = [];
-  modelsToIgnore.push(this.name);
-
-  for (var i = 0; i < this.properties.length; i++) {
-    prop = this.properties[i];
-    if ((prop.refModel != null) && modelsToIgnore.indexOf(prop.refModel.name) === -1) {
-      returnVal = returnVal + ('<br>' + prop.refModel.getMockSignature(modelsToIgnore));
-    }
-  }
-  return returnVal;
-};
-
-SwaggerModel.prototype.createJSONSample = function(modelsToIgnore) {
-  if(sampleModels[this.name]) {
-    return sampleModels[this.name];
-  }
-  else {
-    var result = {};
-    var modelsToIgnore = (modelsToIgnore||[])
-    modelsToIgnore.push(this.name);
-    for (var i = 0; i < this.properties.length; i++) {
-      prop = this.properties[i];
-      result[prop.name] = prop.getSampleValue(modelsToIgnore);
-    }
-    modelsToIgnore.pop(this.name);
-    return result;
-  }
-};
-
-var SwaggerModelProperty = function(name, obj) {
-  this.name = name;
-  this.dataType = obj.type || obj.dataType || obj["$ref"];
-  this.isCollection = this.dataType && (this.dataType.toLowerCase() === 'array' || this.dataType.toLowerCase() === 'list' || this.dataType.toLowerCase() === 'set');
-  this.descr = obj.description;
-  this.required = obj.required;
-  this.defaultValue = modelPropertyMacro(obj.defaultValue);
-  if (obj.items != null) {
-    if (obj.items.type != null) {
-      this.refDataType = obj.items.type;
-    }
-    if (obj.items.$ref != null) {
-      this.refDataType = obj.items.$ref;
-    }
-  }
-  this.dataTypeWithRef = this.refDataType != null ? (this.dataType + '[' + this.refDataType + ']') : this.dataType;
-  if (obj.allowableValues != null) {
-    this.valueType = obj.allowableValues.valueType;
-    this.values = obj.allowableValues.values;
-    if (this.values != null) {
-      this.valuesString = "'" + this.values.join("' or '") + "'";
-    }
-  }
-  if (obj["enum"] != null) {
-    this.valueType = "string";
-    this.values = obj["enum"];
-    if (this.values != null) {
-      this.valueString = "'" + this.values.join("' or '") + "'";
-    }
-  }
-}
-
-SwaggerModelProperty.prototype.getSampleValue = function(modelsToIgnore) {
-  var result;
-  if ((this.refModel != null) && (modelsToIgnore.indexOf(prop.refModel.name) === -1)) {
-    result = this.refModel.createJSONSample(modelsToIgnore);
-  } else {
-    if (this.isCollection) {
-      result = this.toSampleValue(this.refDataType);
-    } else {
-      result = this.toSampleValue(this.dataType);
-    }
-  }
-  if (this.isCollection) {
-    return [result];
-  } else {
-    return result;
-  }
-};
-
-SwaggerModelProperty.prototype.toSampleValue = function(value) {
-  var result;
-  if ((typeof this.defaultValue !== 'undefined') && this.defaultValue !== null) {
-    result = this.defaultValue;
-  } else if (value === "integer") {
-    result = 0;
-  } else if (value === "boolean") {
-    result = false;
-  } else if (value === "double" || value === "number") {
-    result = 0.0;
-  } else if (value === "string") {
-    result = "";
-  } else {
-    result = value;
-  }
-  return result;
-};
-
-SwaggerModelProperty.prototype.toString = function() {
-  var req = this.required ? 'propReq' : 'propOpt';
-  var str = '<span class="propName ' + req + '">' + this.name + '</span> (<span class="propType">' + this.dataTypeWithRef + '</span>';
-  if (!this.required) {
-    str += ', <span class="propOptKey">optional</span>';
-  }
-  str += ')';
-  if (this.values != null) {
-    str += " = <span class='propVals'>['" + this.values.join("' or '") + "']</span>";
-  }
-  if (this.descr != null) {
-    str += ': <span class="propDesc">' + this.descr + '</span>';
-  }
-  return str;
-};
-
-var SwaggerOperation = function(nickname, path, method, parameters, summary, notes, type, responseMessages, resource, consumes, produces, authorizations) {
-  var _this = this;
-
-  var errors = [];
-  this.nickname = (nickname||errors.push("SwaggerOperations must have a nickname."));
-  this.path = (path||errors.push("SwaggerOperation " + nickname + " is missing path."));
-  this.method = (method||errors.push("SwaggerOperation " + nickname + " is missing method."));
-  this.parameters = parameters != null ? parameters : [];
-  this.summary = summary;
-  this.notes = notes;
-  this.type = type;
-  this.responseMessages = (responseMessages||[]);
-  this.resource = (resource||errors.push("Resource is required"));
-  this.consumes = consumes;
-  this.produces = produces;
-  this.authorizations = authorizations;
-  this["do"] = __bind(this["do"], this);
-
-  if (errors.length > 0)
-    this.resource.api.fail(errors);
-
-  this.path = this.path.replace('{format}', 'json');
-  this.method = this.method.toLowerCase();
-  this.isGetMethod = this.method === "get";
-
-  this.resourceName = this.resource.name;
-  if(typeof this.type !== 'undefined' && this.type === 'void')
-    this.type = null;
-  else {
-    this.responseClassSignature = this.getSignature(this.type, this.resource.models);
-    this.responseSampleJSON = this.getSampleJSON(this.type, this.resource.models);
-  }
-
-  for(var i = 0; i < this.parameters.length; i ++) {
-    var param = this.parameters[i];
-    // might take this away
-    param.name = param.name || param.type || param.dataType;
-
-    // for 1.1 compatibility
-    var type = param.type || param.dataType;
-    if(type === 'array') {
-      type = 'array[' + (param.items.$ref ? param.items.$ref : param.items.type) + ']';
-    }
-    param.type = type;
-
-    if(type.toLowerCase() === 'boolean') {
-      param.allowableValues = {};
-      param.allowableValues.values = ["true", "false"];
-    }
-    param.signature = this.getSignature(type, this.resource.models);
-    param.sampleJSON = this.getSampleJSON(type, this.resource.models);
-
-    var enumValue = param["enum"];
-    if(enumValue != null) {
-      param.isList = true;
-      param.allowableValues = {};
-      param.allowableValues.descriptiveValues = [];
-
-      for(var j = 0; j < enumValue.length; j++) {
-        var v = enumValue[j];
-        if(param.defaultValue != null) {
-          param.allowableValues.descriptiveValues.push ({
-            value: String(v),
-            isDefault: (v === param.defaultValue)
-          });
-        }
-        else {
-          param.allowableValues.descriptiveValues.push ({
-            value: String(v),
-            isDefault: false
-          });
-        }
-      }
-    }
-    else if(param.allowableValues != null) {
-      if(param.allowableValues.valueType === "RANGE")
-        param.isRange = true;
-      else
-        param.isList = true;
-      if(param.allowableValues != null) {
-        param.allowableValues.descriptiveValues = [];
-        if(param.allowableValues.values) {
-          for(var j = 0; j < param.allowableValues.values.length; j++){
-            var v = param.allowableValues.values[j];
-            if(param.defaultValue != null) {
-              param.allowableValues.descriptiveValues.push ({
-                value: String(v),
-                isDefault: (v === param.defaultValue)
-              });
-            }
-            else {
-              param.allowableValues.descriptiveValues.push ({
-                value: String(v),
-                isDefault: false
-              });
-            }
-          }
-        }
-      }
-    }
-    param.defaultValue = parameterMacro(param.defaultValue);
-  }
-  this.resource[this.nickname] = function(args, callback, error) {
-    return _this["do"](args, callback, error);
-  };
-  this.resource[this.nickname].help = function() {
-    return _this.help();
-  };
-}
-
-SwaggerOperation.prototype.isListType = function(type) {
-  if (type && type.indexOf('[') >= 0) {
-    return type.substring(type.indexOf('[') + 1, type.indexOf(']'));
-  } else {
-    return void 0;
-  }
-};
-
-SwaggerOperation.prototype.getSignature = function(type, models) {
-  var isPrimitive, listType;
-  listType = this.isListType(type);
-  isPrimitive = ((listType != null) && models[listType]) || (models[type] != null) ? false : true;
-  if (isPrimitive) {
-    return type;
-  } else {
-    if (listType != null) {
-      return models[listType].getMockSignature();
-    } else {
-      return models[type].getMockSignature();
-    }
-  }
-};
-
-SwaggerOperation.prototype.getSampleJSON = function(type, models) {
-  var isPrimitive, listType, val;
-  listType = this.isListType(type);
-  isPrimitive = ((listType != null) && models[listType]) || (models[type] != null) ? false : true;
-  val = isPrimitive ? void 0 : (listType != null ? models[listType].createJSONSample() : models[type].createJSONSample());
-  if (val) {
-    val = listType ? [val] : val;
-    if(typeof val == "string")
-      return val;
-    else if(typeof val === "object") {
-      var t = val;
-      if(val instanceof Array && val.length > 0) {
-        t = val[0];
-      }
-      if(t.nodeName) {
-        var xmlString = new XMLSerializer().serializeToString(t);
-        return this.formatXml(xmlString);
-      }
-      else
-        return JSON.stringify(val, null, 2);
-    }
-    else
-      return val;
-  }
-};
-
-SwaggerOperation.prototype["do"] = function(args, opts, callback, error) {
-  var key, param, params, possibleParams, req, requestContentType, responseContentType, value, _i, _len, _ref;
-  if (args == null) {
-    args = {};
-  }
-  if (opts == null) {
-    opts = {};
-  }
-  requestContentType = null;
-  responseContentType = null;
-  if ((typeof args) === "function") {
-    error = opts;
-    callback = args;
-    args = {};
-  }
-  if ((typeof opts) === "function") {
-    error = callback;
-    callback = opts;
-  }
-  if (error == null) {
-    error = function(xhr, textStatus, error) {
-      return log(xhr, textStatus, error);
-    };
-  }
-  if (callback == null) {
-    callback = function(response) {
-      var content;
-      content = null;
-      if (response != null) {
-        content = response.data;
-      } else {
-        content = "no data";
-      }
-      return log("default callback: " + content);
-    };
-  }
-  params = {};
-  params.headers = [];
-  if (args.headers != null) {
-    params.headers = args.headers;
-    delete args.headers;
-  }
-
-  var possibleParams = [];
-  for(var i = 0; i < this.parameters.length; i++) {
-    var param = this.parameters[i];
-    if(param.paramType === 'header') {
-      if(args[param.name])
-        params.headers[param.name] = args[param.name];
-    }
-    else if(param.paramType === 'form' || param.paramType.toLowerCase() === 'file')
-      possibleParams.push(param);
-  }
-
-  if (args.body != null) {
-    params.body = args.body;
-    delete args.body;
-  }
-
-  if (possibleParams) {
-    var key;
-    for (key in possibleParams) {
-      value = possibleParams[key];
-      if (args[value.name]) {
-        params[value.name] = args[value.name];
-      }
-    }
-  }
-
-  req = new SwaggerRequest(this.method, this.urlify(args), params, opts, callback, error, this);
-  if (opts.mock != null) {
-    return req;
-  } else {
-    return true;
-  }
-};
-
-SwaggerOperation.prototype.pathJson = function() {
-  return this.path.replace("{format}", "json");
-};
-
-SwaggerOperation.prototype.pathXml = function() {
-  return this.path.replace("{format}", "xml");
-};
-
-SwaggerOperation.prototype.encodePathParam = function(pathParam) {
-  var encParts, part, parts, _i, _len;
-  pathParam = pathParam.toString();
-  if (pathParam.indexOf("/") === -1) {
-    return encodeURIComponent(pathParam);
-  } else {
-    parts = pathParam.split("/");
-    encParts = [];
-    for (_i = 0, _len = parts.length; _i < _len; _i++) {
-      part = parts[_i];
-      encParts.push(encodeURIComponent(part));
-    }
-    return encParts.join("/");
-  }
-};
-
-SwaggerOperation.prototype.urlify = function(args) {
-  var url = this.resource.basePath + this.pathJson();
-  var params = this.parameters;
-  for(var i = 0; i < params.length; i ++){
-    var param = params[i];
-    if (param.paramType === 'path') {
-      if(args[param.name]) {
-        // apply path params and remove from args
-        var reg = new RegExp('\{' + param.name + '[^\}]*\}', 'gi');
-        url = url.replace(reg, this.encodePathParam(args[param.name]));
-        delete args[param.name];
-      }
-      else
-        throw "" + param.name + " is a required path param.";
-    }
-  }
-
-  var queryParams = "";
-  for(var i = 0; i < params.length; i ++){
-    var param = params[i];
-    if(param.paramType === 'query') {
-      if (args[param.name] !== undefined) {
-        if (queryParams !== '')
-          queryParams += "&";
-        queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]);
-      }
-    }
-  }
-  if ((queryParams != null) && queryParams.length > 0)
-    url += '?' + queryParams;
-  return url;
-};
-
-SwaggerOperation.prototype.supportHeaderParams = function() {
-  return this.resource.api.supportHeaderParams;
-};
-
-SwaggerOperation.prototype.supportedSubmitMethods = function() {
-  return this.resource.api.supportedSubmitMethods;
-};
-
-SwaggerOperation.prototype.getQueryParams = function(args) {
-  return this.getMatchingParams(['query'], args);
-};
-
-SwaggerOperation.prototype.getHeaderParams = function(args) {
-  return this.getMatchingParams(['header'], args);
-};
-
-SwaggerOperation.prototype.getMatchingParams = function(paramTypes, args) {
-  var matchingParams = {};
-  var params = this.parameters;
-  for (var i = 0; i < params.length; i++) {
-    param = params[i];
-    if (args && args[param.name])
-      matchingParams[param.name] = args[param.name];
-  }
-  var headers = this.resource.api.headers;
-  var name;
-  for (name in headers) {
-    var value = headers[name];
-    matchingParams[name] = value;
-  }
-  return matchingParams;
-};
-
-SwaggerOperation.prototype.help = function() {
-  var msg = "";
-  var params = this.parameters;
-  for (var i = 0; i < params.length; i++) {
-    var param = params[i];
-    if (msg !== "")
-      msg += "\n";
-    msg += "* " + param.name + (param.required ? ' (required)' : '') + " - " + param.description;
-  }
-  return msg;
-};
-
-
-SwaggerOperation.prototype.formatXml = function(xml) {
-  var contexp, formatted, indent, lastType, lines, ln, pad, reg, transitions, wsexp, _fn, _i, _len;
-  reg = /(>)(<)(\/*)/g;
-  wsexp = /[ ]*(.*)[ ]+\n/g;
-  contexp = /(<.+>)(.+\n)/g;
-  xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2');
-  pad = 0;
-  formatted = '';
-  lines = xml.split('\n');
-  indent = 0;
-  lastType = 'other';
-  transitions = {
-    'single->single': 0,
-    'single->closing': -1,
-    'single->opening': 0,
-    'single->other': 0,
-    'closing->single': 0,
-    'closing->closing': -1,
-    'closing->opening': 0,
-    'closing->other': 0,
-    'opening->single': 1,
-    'opening->closing': 0,
-    'opening->opening': 1,
-    'opening->other': 1,
-    'other->single': 0,
-    'other->closing': -1,
-    'other->opening': 0,
-    'other->other': 0
-  };
-  _fn = function(ln) {
-    var fromTo, j, key, padding, type, types, value;
-    types = {
-      single: Boolean(ln.match(/<.+\/>/)),
-      closing: Boolean(ln.match(/<\/.+>/)),
-      opening: Boolean(ln.match(/<[^!?].*>/))
-    };
-    type = ((function() {
-      var _results;
-      _results = [];
-      for (key in types) {
-        value = types[key];
-        if (value) {
-          _results.push(key);
-        }
-      }
-      return _results;
-    })())[0];
-    type = type === void 0 ? 'other' : type;
-    fromTo = lastType + '->' + type;
-    lastType = type;
-    padding = '';
-    indent += transitions[fromTo];
-    padding = ((function() {
-      var _j, _ref5, _results;
-      _results = [];
-      for (j = _j = 0, _ref5 = indent; 0 <= _ref5 ? _j < _ref5 : _j > _ref5; j = 0 <= _ref5 ? ++_j : --_j) {
-        _results.push('  ');
-      }
-      return _results;
-    })()).join('');
-    if (fromTo === 'opening->closing') {
-      return formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
-    } else {
-      return formatted += padding + ln + '\n';
-    }
-  };
-  for (_i = 0, _len = lines.length; _i < _len; _i++) {
-    ln = lines[_i];
-    _fn(ln);
-  }
-  return formatted;
-};
-
-var SwaggerRequest = function(type, url, params, opts, successCallback, errorCallback, operation, execution) {
-  var _this = this;
-  var errors = [];
-  this.useJQuery = (typeof operation.resource.useJQuery !== 'undefined' ? operation.resource.useJQuery : null);
-  this.type = (type||errors.push("SwaggerRequest type is required (get/post/put/delete/patch/options)."));
-  this.url = (url||errors.push("SwaggerRequest url is required."));
-  this.params = params;
-  this.opts = opts;
-  this.successCallback = (successCallback||errors.push("SwaggerRequest successCallback is required."));
-  this.errorCallback = (errorCallback||errors.push("SwaggerRequest error callback is required."));
-  this.operation = (operation||errors.push("SwaggerRequest operation is required."));
-  this.execution = execution;
-  this.headers = (params.headers||{});
-
-  if(errors.length > 0) {
-    throw errors;
-  }
-
-  this.type = this.type.toUpperCase();
-
-  // set request, response content type headers
-  var headers = this.setHeaders(params, this.operation);
-  var body = params.body;
-
-  // encode the body for form submits
-  if (headers["Content-Type"]) {
-    var values = {};
-    var i;
-    var operationParams = this.operation.parameters;
-    for(i = 0; i < operationParams.length; i++) {
-      var param = operationParams[i];
-      if(param.paramType === "form")
-        values[param.name] = param;
-    }
-
-    if(headers["Content-Type"].indexOf("application/x-www-form-urlencoded") === 0) {
-      var encoded = "";
-      var key;
-      for(key in values) {
-        value = this.params[key];
-        if(typeof value !== 'undefined'){
-          if(encoded !== "")
-            encoded += "&";
-          encoded += encodeURIComponent(key) + '=' + encodeURIComponent(value);
-        }
-      }
-      body = encoded;
-    }
-    else if (headers["Content-Type"].indexOf("multipart/form-data") === 0) {
-      // encode the body for form submits
-      var data = "";
-      var boundary = "----SwaggerFormBoundary" + Date.now();
-      var key;
-      for(key in values) {
-        value = this.params[key];
-        if(typeof value !== 'undefined') {
-          data += '--' + boundary + '\n';
-          data += 'Content-Disposition: form-data; name="' + key + '"';
-          data += '\n\n';
-          data += value + "\n";
-        }
-      }
-      data += "--" + boundary + "--\n";
-      headers["Content-Type"] = "multipart/form-data; boundary=" + boundary;
-      body = data;
-    }
-  }
-
-  if (!((this.headers != null) && (this.headers.mock != null))) {
-    obj = {
-      url: this.url,
-      method: this.type,
-      headers: headers,
-      body: body,
-      useJQuery: this.useJQuery,
-      on: {
-        error: function(response) {
-          return _this.errorCallback(response, _this.opts.parent);
-        },
-        redirect: function(response) {
-          return _this.successCallback(response, _this.opts.parent);
-        },
-        307: function(response) {
-          return _this.successCallback(response, _this.opts.parent);
-        },
-        response: function(response) {
-          return _this.successCallback(response, _this.opts.parent);
-        }
-      }
-    };
-    var e;
-    if (typeof window !== 'undefined') {
-      e = window;
-    } else {
-      e = exports;
-    }
-    status = e.authorizations.apply(obj, this.operation.authorizations);
-    if (opts.mock == null) {
-      if (status !== false) {
-        new SwaggerHttp().execute(obj);
-      } else {
-        obj.canceled = true;
-      }
-    } else {
-      return obj;
-    }
-  }
-};
-
-SwaggerRequest.prototype.setHeaders = function(params, operation) {
-  // default type
-  var accepts = "application/json";
-  var consumes = "application/json";
-
-  var allDefinedParams = this.operation.parameters;
-  var definedFormParams = [];
-  var definedFileParams = [];
-  var body = params.body;
-  var headers = {};
-
-  // get params from the operation and set them in definedFileParams, definedFormParams, headers
-  var i;
-  for(i = 0; i < allDefinedParams.length; i++) {
-    var param = allDefinedParams[i];
-    if(param.paramType === "form")
-      definedFormParams.push(param);
-    else if(param.paramType === "file")
-      definedFileParams.push(param);
-    else if(param.paramType === "header" && this.params.headers) {
-      var key = param.name;
-      var headerValue = this.params.headers[param.name];
-      if(typeof this.params.headers[param.name] !== 'undefined')
-        headers[key] = headerValue;
-    }
-  }
-
-  // if there's a body, need to set the accepts header via requestContentType
-  if (body && (this.type === "POST" || this.type === "PUT" || this.type === "PATCH" || this.type === "DELETE")) {
-    if (this.opts.requestContentType)
-      consumes = this.opts.requestContentType;
-  } else {
-    // if any form params, content type must be set
-    if(definedFormParams.length > 0) {
-      if(definedFileParams.length > 0)
-        consumes = "multipart/form-data";
-      else
-        consumes = "application/x-www-form-urlencoded";
-    }
-    else if (this.type === "DELETE")
-      body = "{}";
-    else if (this.type != "DELETE")
-      accepts = null;
-  }
-
-  if (consumes && this.operation.consumes) {
-    if (this.operation.consumes.indexOf(consumes) === -1) {
-      log("server doesn't consume " + consumes + ", try " + JSON.stringify(this.operation.consumes));
-      consumes = this.operation.consumes[0];
-    }
-  }
-
-  if (this.opts.responseContentType) {
-    accepts = this.opts.responseContentType;
-  } else {
-    accepts = "application/json";
-  }
-  if (accepts && this.operation.produces) {
-    if (this.operation.produces.indexOf(accepts) === -1) {
-      log("server can't produce " + accepts);
-      accepts = this.operation.produces[0];
-    }
-  }
-
-  if ((consumes && body !== "") || (consumes === "application/x-www-form-urlencoded"))
-    headers["Content-Type"] = consumes;
-  if (accepts)
-    headers["Accept"] = accepts;
-  return headers;
-}
-
-SwaggerRequest.prototype.asCurl = function() {
-  var results = [];
-  if(this.headers) {
-    var key;
-    for(key in this.headers) {
-      results.push("--header \"" + key + ": " + this.headers[v] + "\"");
-    }
-  }
-  return "curl " + (results.join(" ")) + " " + this.url;
-};
-
-/**
- * SwaggerHttp is a wrapper for executing requests
- */
-var SwaggerHttp = function() {};
-
-SwaggerHttp.prototype.execute = function(obj) {
-  if(obj && (typeof obj.useJQuery === 'boolean'))
-    this.useJQuery = obj.useJQuery;
-  else
-    this.useJQuery = this.isIE8();
-
-  if(this.useJQuery)
-    return new JQueryHttpClient().execute(obj);
-  else
-    return new ShredHttpClient().execute(obj);
-}
-
-SwaggerHttp.prototype.isIE8 = function() {
-  var detectedIE = false;
-  if (typeof navigator !== 'undefined' && navigator.userAgent) {
-    nav = navigator.userAgent.toLowerCase();
-    if (nav.indexOf('msie') !== -1) {
-      var version = parseInt(nav.split('msie')[1]);
-      if (version <= 8) {
-        detectedIE = true;
-      }
-    }
-  }
-  return detectedIE;
-};
-
-/*
- * JQueryHttpClient lets a browser take advantage of JQuery's cross-browser magic.
- * NOTE: when jQuery is available it will export both '$' and 'jQuery' to the global space.
- *       Since we are using closures here we need to alias it for internal use.
- */
-var JQueryHttpClient = function(options) {
-  "use strict";
-  if(!jQuery){
-    var jQuery = window.jQuery;
-  }
-}
-
-JQueryHttpClient.prototype.execute = function(obj) {
-  var cb = obj.on;
-  var request = obj;
-
-  obj.type = obj.method;
-  obj.cache = false;
-
-  obj.beforeSend = function(xhr) {
-    var key, results;
-    if (obj.headers) {
-      results = [];
-      var key;
-      for (key in obj.headers) {
-        if (key.toLowerCase() === "content-type") {
-          results.push(obj.contentType = obj.headers[key]);
-        } else if (key.toLowerCase() === "accept") {
-          results.push(obj.accepts = obj.headers[key]);
-        } else {
-          results.push(xhr.setRequestHeader(key, obj.headers[key]));
-        }
-      }
-      return results;
-    }
-  };
-
-  obj.data = obj.body;
-  obj.complete = function(response, textStatus, opts) {
-    var headers = {},
-        headerArray = response.getAllResponseHeaders().split("\n");
-
-    for(var i = 0; i < headerArray.length; i++) {
-      var toSplit = headerArray[i].trim();
-      if(toSplit.length === 0)
-        continue;
-      var separator = toSplit.indexOf(":");
-      if(separator === -1) {
-        // Name but no value in the header
-        headers[toSplit] = null;
-        continue;
-      }
-      var name = toSplit.substring(0, separator).trim(),
-          value = toSplit.substring(separator + 1).trim();
-      headers[name] = value;
-    }
-
-    var out = {
-      url: request.url,
-      method: request.method,
-      status: response.status,
-      data: response.responseText,
-      headers: headers
-    };
-
-    var contentType = (headers["content-type"]||headers["Content-Type"]||null)
-
-    if(contentType != null) {
-      if(contentType.indexOf("application/json") == 0 || contentType.indexOf("+json") > 0) {
-        if(response.responseText && response.responseText !== "")
-          out.obj = JSON.parse(response.responseText);
-        else
-          out.obj = {}
-      }
-    }
-
-    if(response.status >= 200 && response.status < 300)
-      cb.response(out);
-    else if(response.status === 0 || (response.status >= 400 && response.status < 599))
-      cb.error(out);
-    else
-      return cb.response(out);
-  };
-
-  jQuery.support.cors = true;
-  return jQuery.ajax(obj);
-}
-
-/*
- * ShredHttpClient is a light-weight, node or browser HTTP client
- */
-var ShredHttpClient = function(options) {
-  this.options = (options||{});
-  this.isInitialized = false;
-
-  var identity, toString;
-
-  if (typeof window !== 'undefined') {
-    this.Shred = require("./shred");
-    this.content = require("./shred/content");
-  }
-  else
-    this.Shred = require("shred");
-  this.shred = new this.Shred();
-}
-
-ShredHttpClient.prototype.initShred = function () {
-  this.isInitialized = true;
-  this.registerProcessors(this.shred);
-}
-
-ShredHttpClient.prototype.registerProcessors = function(shred) {
-  var identity = function(x) {
-    return x;
-  };
-  var toString = function(x) {
-    return x.toString();
-  };
-
-  if (typeof window !== 'undefined') {
-    this.content.registerProcessor(["application/json; charset=utf-8", "application/json", "json"], {
-      parser: identity,
-      stringify: toString
-    });
-  } else {
-    this.Shred.registerProcessor(["application/json; charset=utf-8", "application/json", "json"], {
-      parser: identity,
-      stringify: toString
-    });
-  }
-}
-
-ShredHttpClient.prototype.execute = function(obj) {
-  if(!this.isInitialized)
-    this.initShred();
-
-  var cb = obj.on, res;
-
-  var transform = function(response) {
-    var out = {
-      headers: response._headers,
-      url: response.request.url,
-      method: response.request.method,
-      status: response.status,
-      data: response.content.data
-    };
-
-    var contentType = (response._headers["content-type"]||response._headers["Content-Type"]||null)
-
-    if(contentType != null) {
-      if(contentType.indexOf("application/json") == 0 || contentType.indexOf("+json") > 0) {
-        if(response.content.data && response.content.data !== "")
-          out.obj = JSON.parse(response.content.data);
-        else
-          out.obj = {}
-      }
-    }
-    return out;
-  };
-
-  // Transform an error into a usable response-like object
-  var transformError = function(error) {
-    var out = {
-      // Default to a status of 0 - The client will treat this as a generic permissions sort of error
-      status: 0,
-      data: error.message || error
-    };
-
-    if(error.code) {
-      out.obj = error;
-
-      if(error.code === 'ENOTFOUND' || error.code === 'ECONNREFUSED' ) {
-        // We can tell the client that this should be treated as a missing resource and not as a permissions thing
-        out.status = 404;
-      }
-    }
-
-    return out;
-  };
-
-  res = {
-    error: function(response) {
-      if (obj)
-        return cb.error(transform(response));
-    },
-    // Catch the Shred error raised when the request errors as it is made (i.e. No Response is coming)
-    request_error: function(err) {
-      if(obj)
-        return cb.error(transformError(err));
-    },
-    redirect: function(response) {
-      if (obj)
-        return cb.redirect(transform(response));
-    },
-    307: function(response) {
-      if (obj)
-        return cb.redirect(transform(response));
-    },
-    response: function(response) {
-      if (obj)
-        return cb.response(transform(response));
-    }
-  };
-  if (obj) {
-    obj.on = res;
-  }
-  return this.shred.request(obj);
-};
-
-/**
- * SwaggerAuthorizations applys the correct authorization to an operation being executed
- */
-var SwaggerAuthorizations = function() {
-  this.authz = {};
-};
-
-SwaggerAuthorizations.prototype.add = function(name, auth) {
-  this.authz[name] = auth;
-  return auth;
-};
-
-SwaggerAuthorizations.prototype.remove = function(name) {
-  return delete this.authz[name];
-};
-
-SwaggerAuthorizations.prototype.apply = function(obj, authorizations) {
-  var status = null;
-  var key;
-
-  // if the "authorizations" key is undefined, or has an empty array, add all keys
-  if(typeof authorizations === 'undefined' || Object.keys(authorizations).length == 0) {
-    for (key in this.authz) {
-      value = this.authz[key];
-      result = value.apply(obj, authorizations);
-      if (result === true)
-        status = true;
-    }
-  }
-  else {
-    for(name in authorizations) {
-      for (key in this.authz) {
-        if(key == name) {
-          value = this.authz[key];
-          result = value.apply(obj, authorizations);
-          if (result === true)
-            status = true;
-        }
-      }      
-    }
-  }
-
-  return status;
-};
-
-/**
- * ApiKeyAuthorization allows a query param or header to be injected
- */
-var ApiKeyAuthorization = function(name, value, type, delimiter) {
-  this.name = name;
-  this.value = value;
-  this.type = type;
-  this.delimiter = delimiter;
-};
-
-ApiKeyAuthorization.prototype.apply = function(obj, authorizations) {
-  if (this.type === "query") {
-    if (obj.url.indexOf('?') > 0)
-      obj.url = obj.url + "&" + this.name + "=" + this.value;
-    else
-      obj.url = obj.url + "?" + this.name + "=" + this.value;
-    return true;
-  } else if (this.type === "header") {
-    if(typeof obj.headers[this.name] !== 'undefined') {
-      if(typeof this.delimiter !== 'undefined')
-        obj.headers[this.name] = obj.headers[this.name] + this.delimiter +  this.value;
-    }
-    else
-      obj.headers[this.name] = this.value;
-    return true;
-  }
-};
-
-var CookieAuthorization = function(cookie) {
-  this.cookie = cookie;
-}
-
-CookieAuthorization.prototype.apply = function(obj, authorizations) {
-  obj.cookieJar = obj.cookieJar || CookieJar();
-  obj.cookieJar.setCookie(this.cookie);
-  return true;
-}
-
-/**
- * Password Authorization is a basic auth implementation
- */
-var PasswordAuthorization = function(name, username, password) {
-  this.name = name;
-  this.username = username;
-  this.password = password;
-  this._btoa = null;
-  if (typeof window !== 'undefined')
-    this._btoa = btoa;
-  else
-    this._btoa = require("btoa");
-};
-
-PasswordAuthorization.prototype.apply = function(obj, authorizations) {
-  var base64encoder = this._btoa;
-  obj.headers["Authorization"] = "Basic " + base64encoder(this.username + ":" + this.password);
-  return true;
-};
-
-var e = (typeof window !== 'undefined' ? window : exports);
-
-var sampleModels = {};
-var cookies = {};
-
-e.SampleModels = sampleModels;
-e.SwaggerHttp = SwaggerHttp;
-e.SwaggerRequest = SwaggerRequest;
-e.authorizations = new SwaggerAuthorizations();
-e.ApiKeyAuthorization = ApiKeyAuthorization;
-e.PasswordAuthorization = PasswordAuthorization;
-e.CookieAuthorization = CookieAuthorization;
-e.JQueryHttpClient = JQueryHttpClient;
-e.ShredHttpClient = ShredHttpClient;
-e.SwaggerOperation = SwaggerOperation;
-e.SwaggerModel = SwaggerModel;
-e.SwaggerModelProperty = SwaggerModelProperty;
-e.SwaggerResource = SwaggerResource;
-e.SwaggerApi = SwaggerApi;

文件差异内容过多而无法显示
+ 0 - 4
htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/underscore-min.js


文件差异内容过多而无法显示
+ 0 - 0
htdocs/includes/restler/framework/Luracast/Restler/explorer/lib/underscore-min.map


+ 3 - 3
htdocs/includes/restler/framework/Luracast/Restler/explorer/o2c.html

@@ -1,6 +1,6 @@
 <script>
 var qp = null;
-if(window.location.hash) {
+if(/code|token|error/.test(window.location.hash)) {
   qp = location.hash.substring(1);
 }
 else {
@@ -11,10 +11,10 @@ qp = qp ? JSON.parse('{"' + qp.replace(/&/g, '","').replace(/=/g,'":"') + '"}',
     return key===""?value:decodeURIComponent(value) }
   ):{}
 
-if (window.opener.swaggerUi.tokenUrl)
+if (window.opener.swaggerUiAuth.tokenUrl)
     window.opener.processOAuthCode(qp);
 else
     window.opener.onOAuthComplete(qp);
 
 window.close();
-</script>
+</script>

文件差异内容过多而无法显示
+ 971 - 1508
htdocs/includes/restler/framework/Luracast/Restler/explorer/swagger-ui.js


文件差异内容过多而无法显示
+ 0 - 0
htdocs/includes/restler/framework/Luracast/Restler/explorer/swagger-ui.min.js


部分文件因为文件数量过多而无法显示