Skip to content
This repository has been archived by the owner on Dec 16, 2023. It is now read-only.

Commit

Permalink
Use querystring.stringify instead of url.format: it's cleaner
Browse files Browse the repository at this point in the history
  • Loading branch information
assaf committed Dec 19, 2010
1 parent b0c12cc commit 49617fc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/zombie/history.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
jsdom = require("jsdom")
http = require("http")
URL = require("url")
qs = require("querystring")

# ## window.history
#
Expand Down Expand Up @@ -101,7 +102,7 @@ class History
# Create new DOM Level 3 document, add features (load external
# resources, etc) and associate it with current document. From this
# point on the browser sees a new document, client register event
# handlers for DOMContentLoaded/error.
# handler for DOMContentLoaded/error.
aug = jsdom.browserAugmentation(jsdom.dom.level3.html)
document = new aug.HTMLDocument(url: URL.format(url), deferClose: true)
jsdom.applyDocumentFeatures document
Expand All @@ -111,7 +112,7 @@ class History
if method == "GET"
url.search = URL.resolve(url, { query: data }).split("?")[1]
else
data = URL.format({ query: data }).substring(1)
data = qs.stringify(data)
headers["content-type"] = enctype || "application/x-www-form-urlencoded"
headers["content-length"] = data.length
headers["cookie"] = cookies._header(url)
Expand Down

0 comments on commit 49617fc

Please sign in to comment.