Commit 00747d8d 00747d8df822d259acce7f8e3103c55b11a9b114 by Laurent Jouanneau

Fixes http headers in casper.open

Original http headers should be set only after the
query append, not immediately after calling webpage.openUrl.
The request initialization may take time, and so customHeaders
are not send because they are erased by the original value
before the request initialization. (at least in Gecko)
1 parent b49e6165
......@@ -1384,12 +1384,15 @@ Casper.prototype.open = function open(location, settings) {
this.page.customHeaders = utils.mergeObjects(utils.clone(baseCustomHeaders), customHeaders);
// perfom request
this.browserInitializing = true;
var self = this;
this.page.openUrl(this.requestUrl, {
operation: settings.method,
data: settings.data
}, this.page.settings);
}, this.page.settings, function(){
// revert base custom headers
this.page.customHeaders = baseCustomHeaders;
self.page.customHeaders = baseCustomHeaders;
});
return this;
};
......