Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

We still need a document element when response body is empty.

Updated changelog to reflect recent additions.
  • Loading branch information...
commit ffc09acda317b7db9eaee1bd30ccbd24ead03200 1 parent e2682e9
@assaf authored
View
10 CHANGELOG.md
@@ -2,6 +2,16 @@ zombie.js-changelog(7) -- Changelog
===================================
+### Version 0.8.11 2011-01-19
+
+Ensure fields are sent in the order they are described (José Valim).
+
+Fix parsing of empty body (Vinicius Baggio).
+
+ 267 Tests
+ 3.8 sec to complete
+
+
### Version 0.8.10 2011-01-13
Allow setting cookies from subdomains (Damian Janowski & Michel Martens).
View
5 spec/browser-spec.coffee
@@ -74,6 +74,8 @@ brains.get "/dead", (req, res)-> res.send """
</html>
"""
+brains.get "/empty", (req, res)-> res.send ""
+
brains.get "/soup", (req, res)-> res.send """
<h1>Tag soup</h1>
<p>One paragraph
@@ -138,6 +140,9 @@ vows.describe("Browser").addBatch(
"should pass single argument to callback": (args)-> assert.length args, 1
"should pass error to callback": (args)-> assert.ok args[0] instanceof Error
"should include status code in error": (args)-> assert.equal args[0].statusCode, 404
+ "empty page":
+ zombie.wants "http://localhost:3003/empty"
+ "should load document": (browser)-> assert.ok browser.body
"event emitter":
"successful":
View
6 spec/history-spec.coffee
@@ -8,8 +8,6 @@ brains.get "/boo", (req, res)->
res.send "<html><title>#{response}</title></html>"
brains.get "/redirect", (req, res)->
res.redirect "/boo?redirected=true"
-brains.get "/empty", (req, res)->
- res.send ""
vows.describe("History").addBatch(
@@ -156,10 +154,6 @@ vows.describe("History").addBatch(
"should include pathname": (location)-> assert.equal location.pathname, "/"
"should include search": (location)-> assert.equal location.search, ""
"should include hash": (location)-> assert.equal location.hash, ""
- "empty":
- zombie.wants "http://localhost:3003/empty"
- "should load document": (browser)-> assert.equal browser.html(), ''
-
"redirect":
zombie.wants "http://localhost:3003/redirect"
View
3  src/zombie/history.coffee
@@ -163,11 +163,12 @@ class History
switch response.statusCode
when 200
browser.cookies(url.hostname, url.pathname).update response.headers["set-cookie"]
+ body = "<html></html>" if body.trim() == ""
document.open()
document.write body
document.close()
- if document.documentElement or response.headers["content-length"] == '0'
+ if document.documentElement
browser.emit "loaded", browser
else
error = "Could not parse document at #{URL.format(url)}"

1 comment on commit ffc09ac

@vinibaggio

Thanks for cleaning it up!

Please sign in to comment.
Something went wrong with that request. Please try again.