Skip to content

Commit

Permalink
Add parseQueryString argument to the url.parse so it matches signatur…
Browse files Browse the repository at this point in the history
…e in node.
  • Loading branch information
Kami committed Jun 5, 2012
1 parent 641eeb2 commit 0ff19e7
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/luvit/url.lua
Expand Up @@ -16,9 +16,11 @@ limitations under the License.
--]]
local querystring = require('querystring')
local url = {}
function url.parse(url)
function url.parse(url, parseQueryString)
local href = url
local chunk, protocol = url:match("^(([a-z0-9+]+)://)")
url = url:sub((chunk and #chunk or 0) + 1)
Expand All @@ -33,7 +35,11 @@ function url.parse(url)
local pathname = url:match("^[^?]*")
local search = url:sub((pathname and #pathname or 0) + 1)
local query = search:sub(2)
if parseQueryString then
query = querystring.parse(query)
end
return {
href = href,
protocol = protocol,
Expand Down

0 comments on commit 0ff19e7

Please sign in to comment.