var obj = arguments[headerIndex];
- if (obj && this._headers) {
- if (util.isArray(obj)) {
- // handle array case
- // TODO: remove when array is no longer accepted
- var field;
- for (var i = 0, len = obj.length; i < len; ++i) {
- field = obj[i][0];
- if (!util.isUndefined(headers[field])) {
- obj.push([field, headers[field]]);
- }
- }
- headers = obj;
-
- } else {
- // handle object case
+ if (this._headers) {
+ // Slow-case: when progressive API and header fields are passed.
+ if (obj) {
var keys = Object.keys(obj);
for (var i = 0; i < keys.length; i++) {
var k = keys[i];
if (k) this.setHeader(k, obj[k]);
}
- // Slow-case: when progressive API and header fields are passed.
- headers = this._renderHeaders();
}
- } else if (this._headers) {
// only progressive api is used
headers = this._renderHeaders();
} else {