Browse files

Fixes POST params

  • Loading branch information...
1 parent 4c37a7d commit a44f24944ba40cb6f953cd54f31d221fb3966dcb @pnegri committed Jan 31, 2012
Showing with 10 additions and 5 deletions.
  1. +8 −4 lib/arcabouco_modules/request.coffee
  2. +1 −0 lib/common.coffee
  3. +1 −1 package.json
View
12 lib/arcabouco_modules/request.coffee
@@ -47,11 +47,15 @@ class ArcaboucoRequest
else
false
- parseRequest : ( request ) ->
+ parseRequest : ( request, data ) ->
request.setEncoding 'utf-8'
url = Common.Url.parse request.url, true
request.documentRequested = url.pathname
- request.query = url.query
+
+ if request.method == 'POST'
+ request.query = Common.Query.parse(data)
+ else
+ request.query = url.query
buildParamsForRequest: ( route, args, otherParams ) ->
params = {}
@@ -71,10 +75,10 @@ class ArcaboucoRequest
request.addListener 'data', ( data_chunk ) =>
data += data_chunk
- @parseRequest( request )
-
request.addListener 'end', =>
+ @parseRequest( request, data )
+
hasRouted = false
for route in @avaiableRoutes
View
1 lib/common.coffee
@@ -15,6 +15,7 @@ Common =
Fs : require 'fs'
Path : require 'path'
Url : require 'url'
+ Query: require 'querystring'
Crypt: require 'crypto'
_ : require 'underscore' # Enable Underscore Library using Common._
View
2 package.json
@@ -1,7 +1,7 @@
{
"name" : "arcabouco-js",
"description" : "scalable microframework in node.js",
- "version" : "0.8.3",
+ "version" : "0.8.4",
"author" : "Patrick Negri <patrick@iugu.com.br>",
"homepage": "http://github.com/pnegri/arcabouco-js",
"contributors" : [],

0 comments on commit a44f249

Please sign in to comment.