Browse Source

Fix incorrect header type #290

Ben Hsieh 7 years ago
parent
commit
f451a2c3a3
1 changed files with 4 additions and 1 deletions
  1. 4
    1
      index.js

+ 4
- 1
index.js View File

@@ -220,7 +220,10 @@ function fetch(...args:any):Promise {
220 220
 
221 221
   // # 241 normalize null or undefined headers, in case nil or null string
222 222
   // pass to native context
223
-  headers = _.map(headers, (h) => h || '' );
223
+  headers = _.reduce(headers, (result, value, key) => {
224
+    result[key] = value || ''
225
+    return result
226
+  }, {});
224 227
 
225 228
   // fetch from file system
226 229
   if(URIUtil.isFileURI(url)) {