Implement Request.setHeader() method
This patch implements Request.setHeader() method to override request headers. References #8.
This commit is contained in:
parent
5ba6621cde
commit
50976c7f29
@ -71,10 +71,13 @@ class Request {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {!Object} headers
|
||||
* @param {string} key
|
||||
* @param {string} value
|
||||
*/
|
||||
setHeaders(headers) {
|
||||
this._headersOverride = headers;
|
||||
setHeader(key, value) {
|
||||
if (!this._headersOverride)
|
||||
this._headersOverride = Object.assign({}, this._headers);
|
||||
this._headersOverride[key] = value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,4 +1,3 @@
|
||||
//! unsupported
|
||||
async_test(function () {
|
||||
var webpage = require('webpage');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user