Permalink
Browse files

Basic support for array query parameters

Example of how to specify:

{
  "Name":"arrayParam",
  "Type":"array",
  "Description":"Array of values"
}            

Example of resulting query string:

 … ?param[0]=first-value&param[1]=second-value
  • Loading branch information...
1 parent 85d485d commit d48364b424ac095be1b7b5bd3d420a5ae96663d2 @stou committed Dec 18, 2012
Showing with 11 additions and 2 deletions.
  1. +1 −1 app.js
  2. +1 −1 package.json
  3. +6 −0 public/javascripts/docs.js
  4. +3 −0 views/api.jade
View
2 app.js
@@ -28,7 +28,7 @@ var express = require('express'),
util = require('util'),
fs = require('fs'),
OAuth = require('oauth').OAuth,
- query = require('querystring'),
+ query = require('qs'),
url = require('url'),
http = require('http'),
https = require('https'),
View
@@ -26,7 +26,7 @@
"jade": "0.13",
"oauth": "0.9.3",
"redis": ">= 0.7.0",
- "querystring": "0.1.0"
+ "qs": ">= 0.5.3"
},
"devDependencies": {},
"main": "index",
@@ -1,5 +1,11 @@
(function() {
+ // Add entry to html array type
+ $('td.parameter > input.add-array-entry').click(function() {
+ $(this).prev().clone().val("").insertBefore(this);
+ })
+
+
// Storing common selections
var allEndpoints = $('li.endpoint'),
allEndpointsLength = allEndpoints.length,
View
@@ -109,6 +109,9 @@ ul
option(value=choice, selected=true) #{choice}
- else
option(value=choice) #{choice}
+ - else if (parameter.Type =='array')
+ input.array-entry(name='params[' + parameter.Name + ']', value=parameter.Default, placeholder=className, style="float: left; clear: both;")
+ input.add-array-entry(type='button', value='Add entry', name=parameter.Name)
- else if (parameter.Type =='boolean')
select(name='params[' + parameter.Name + ']', placeholder=className)
- if (parameter.Default =='')

0 comments on commit d48364b

Please sign in to comment.