Permalink
Browse files

add match for either '.' or ':' in url to allow for urls like localho…

…st:3000
  • Loading branch information...
1 parent 9815322 commit 5c27f5be9ec678caae7624029ec92226a14daf01 @gradus gradus committed Oct 1, 2011
Showing with 2 additions and 2 deletions.
  1. +2 −2 index.coffee
View
@@ -2,7 +2,7 @@ request = require 'request'
module.exports =
get: ->
return console.log 'get [uri] - uri is required ex. http://twitter.com/search.json?q=nodejs' unless process.argv[2]
- return console.log 'get [uri] - uri is not valid' unless process.argv[2].match /https?\:\/\/(.*)\.(.*)/
+ return console.log 'get [uri] - uri is not valid' unless process.argv[2].match /https?\:\/\/(.*)(\.|:)(.*)/
request uri: process.argv[2], json: true, (err, resp, body) ->
console.log body
post: ->
@@ -11,4 +11,4 @@ module.exports =
json = JSON.stringify(JSON.parse(process.argv[3]))
return console.log 'valid json required!' unless json?
request.post uri: process.argv[2], json: json, (err, resp, body) ->
- console.log body
+ console.log body

0 comments on commit 5c27f5b

Please sign in to comment.