Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

#259: add Accept-Encoding (compression method)

  • Loading branch information...
commit 770cd61291a9f8551dc3918ee32801aaaee956be 1 parent 27c44b0
U-jingshan\nauhygon authored
Showing with 5 additions and 1 deletion.
  1. +4 −1 lib/zombie/browser.coffee
  2. +1 −0  lib/zombie/resources.coffee
View
5 lib/zombie/browser.coffee
@@ -20,7 +20,7 @@ WebSocket = require("./websocket")
HTML = JSDom.dom.level3.html
MOUSE_EVENT_NAMES = ["mousedown", "mousemove", "mouseup"]
-BROWSER_OPTIONS = ["credentials", "debug", "htmlParser", "loadCSS", "referer", "runScripts", "silent", "site", "userAgent", "waitFor"]
+BROWSER_OPTIONS = ["acceptEncoding", "credentials", "debug", "htmlParser", "loadCSS", "referer", "runScripts", "silent", "site", "userAgent", "waitFor"]
PACKAGE = JSON.parse(require("fs").readFileSync(__dirname + "/../../package.json"))
@@ -52,6 +52,9 @@ class Browser extends EventEmitter
# -------
+ # Supported compression schema names (called content-coding tokens), separated by commas.
+ @acceptEncoding = "identity"
+
# Object containing authorization credentials. Supported schemes include
# `basic` (HTTP Basic), `oauth` (OAuth 2.0 draft 10) and `bearer` (OAuth
# 2.0 draft 20). Scheme name is case insensitive.
View
1  lib/zombie/resources.coffee
@@ -166,6 +166,7 @@ class Resources extends Array
# Clone headers before we go and modify them.
headers = if headers then JSON.parse(JSON.stringify(headers)) else {}
+ headers["Accept-Encoding"] = @_browser.acceptEncoding
headers["User-Agent"] = @_browser.userAgent
if method == "GET" || method == "HEAD"
# Request paramters go in query string
Please sign in to comment.
Something went wrong with that request. Please try again.