caddis
Advanced tools
Comparing version 0.4.2 to 0.4.3
@@ -0,1 +1,5 @@ | ||
0.4.2 / 2014-03-04 | ||
================== | ||
* allow for special characters in uri param values. | ||
0.4.1 / 2014-03-03 | ||
@@ -2,0 +6,0 @@ ================== |
@@ -14,2 +14,4 @@ 'use strict'; | ||
var COLON_REPLACE = '[^\/]+'; | ||
var QUERY_PARAM_TOKEN = /[\\?&]*=([^&]*)?/gi; | ||
var QUERY_PARAM_REPLACE = '=\\w+'; | ||
@@ -48,2 +50,5 @@ var print = function(message) { | ||
var tokenizeURI = function(uri) { | ||
uri = uri.replace(COLON_TOKEN, COLON_REPLACE); | ||
uri = uri.replace('?', '\\?'); | ||
uri = uri.replace(QUERY_PARAM_TOKEN, QUERY_PARAM_REPLACE); | ||
return '^' + uri.replace(COLON_TOKEN, COLON_REPLACE) + '$'; | ||
@@ -55,4 +60,6 @@ }; | ||
if(routeMap.hasOwnProperty(normalizedMethod)) { | ||
route.regex = new RegExp(tokenizeURI(route.uri)); | ||
route.regexStr = tokenizeURI(route.uri); | ||
route.regex = new RegExp(route.regexStr); | ||
route.match = function(uri) { | ||
print('Attempt to match: ' + this.regexStr + ', ' + uri); | ||
return uri.match(this.regex); | ||
@@ -59,0 +66,0 @@ }; |
{ | ||
"name": "caddis", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
@@ -13,2 +13,18 @@ Caddis | ||
``` | ||
$ caddis -h | ||
usage: caddis [action] [port] | ||
Starts a server at http://localhost:<port> as a daemon, exposing an api to post JSON to in order to mock a RESTful service. | ||
Defaults to port 3001 unless --port option provided. | ||
actions: | ||
start Start Caddis at http://localhost:<port> | ||
stop Stop a previously started Caddis daemon | ||
options: | ||
-h Display this help menu | ||
-p Desired port to start server on localhost | ||
``` | ||
Usage | ||
@@ -15,0 +31,0 @@ --- |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
38471
46
612
144