You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I set headers with object, but the object type gave Map, so the header think it's not an object
header: function (field, value) {
if (is(field).a(Object)) {
for (var key in field) {
if (Object.prototype.hasOwnProperty.call(field, key)) {
$this.header(key, field[key])
}
}
return $this
}
var existingHeaderName = $this.hasHeader(field)
$this.options.headers[existingHeaderName || field] = value
return $this
},
see the error stack:
name.toLowerCase is not a function
at Object.hasHeader (/Users/xiwz/ynote/electron-sdk/example/node_modules/unirest/index.js:93:21)
at Object.header (/Users/xiwz/ynote/electron-sdk/example/node_modules/unirest/index.js:198:40)
But actually I send the object
{
'Content-Type': '',
'Cookie': ''
}
I think this bug belongs to electron.It changed the Object default behavior. But unirest type check is unsafe.
I wonder if you would like to improve it ? I am willing to send a PR.
My solution:
if (check.prototype) check = Object.prototype.toString.call(check.prototype).slice(8, -1).toLowerCase()
The text was updated successfully, but these errors were encountered:
In
[email protected]
I find an interesting bug.
I set headers with object, but the object type gave
Map
, so the header think it's not an objectsee the error stack:
But actually I send the object
I think this bug belongs to electron.It changed the Object default behavior. But
unirest
type check is unsafe.I wonder if you would like to improve it ? I am willing to send a PR.
My solution:
The text was updated successfully, but these errors were encountered: