New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added basic support for array query parameters #61

Closed
wants to merge 4 commits into
from
Jump to file or symbol
Failed to load files and symbols.
+43 −4
Diff settings

Always

Just for now

View
4 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'),
@@ -309,7 +309,7 @@ function processRequest(req, res, next) {
// If the param is actually a part of the URL, put it in the URL and remove the param
if (!!regx.test(methodURL)) {
- methodURL = methodURL.replace(regx, params[param]);
+ methodURL = methodURL.replace(regx, encodeURIComponent(params[param]));
delete params[param]
}
} else {
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,4 +1,11 @@
{
+ "arrayparamdemo": {
+ "name": "Stou array param demo",
+ "protocol": "http",
+ "baseURL": "localhost",
+ "publicPath": "/1",
+ "headers" : {}
+ },
"klout": {
"name": "Klout API",
"protocol": "http",
@@ -0,0 +1,23 @@
+{
+ "endpoints":[
+ {
+ "name":"MyDemo",
+ "methods":[
+ {
+ "MethodName":"MyMethod",
+ "Synopsis":"Demonstrates how to specify parameter of array type",
+ "HTTPMethod":"GET",
+ "URI":"/my-method",
+ "RequiresOAuth":"N",
+ "parameters":[
+ {
+ "Name":"myArrayParam",
+ "Type":"array",
+ "Description":"Array of values"
+ }
+ ]
+ }
+ ]
+ }
+ ]
+}
@@ -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,
@@ -233,7 +239,7 @@
.addClass('response prettyprint'));
}
- console.log(params);
+ // console.log(params);
$.post('/processReq', params, function(result, text) {
// If we get passed a signin property, open a window to allow the user to signin/link their account
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 =='')