Open ozyman42 opened 5 years ago
The headers property is a JavaScript object with name/value pairs.
Sent with GitHawk
You're running within the context of node, not the browser. You can polyfill the Headers
class from the browser: https://www.npmjs.com/package/fetch-headers
You're better off just using a vanilla object though...
If the goal of Zombie.js is to create a headless browser environment for
full-stack testing
then code that relies on browser APIs should be supported, thus Zombie.js should be polyfilling the entire Fetch API.
If Zombie.js does not plan to support standardized APIs available in most browsers, then it should consider changing its stated goals or maybe documenting which APIs it does not plan on supporting.
I'd be more than happy to submit a PR that adds the polyfills.
I instruct Zombie to visit a page which has the following code:
Then I get an error that
Headers is not defined
, so the script within the simulated headless browser does not continue because it does not recognizeHeaders
. Do I need to add some option to Zombie so it recognizes the entire standard JS Fetch API?