GET requests with http basic authentication credentials such as "http://user:[email protected]" fail with error "self._qs.unescape is not a function".
This error occurs in request.js:
if (self.uri.auth && !self.hasHeader('authorization')) {
var uriAuthPieces = self.uri.auth.split(':').map(function(item) {return self._qs.unescape(item)})
self.auth(uriAuthPieces[0], uriAuthPieces.slice(1).join(':'), true)
}
Changing Querystring.prototype.unescape
to use the global unescape()
or decodeURIComponent
appears to resolve this issue.
Environment: Electron 0.27.2 (chrome 43)
That might be related to https://github.com/request/request/pull/1600 but tbh I don't see how's that possible. I need more context, can you provide a short code example that reproduces that bug?
It seems that the "querystring" library supplied by Browserify does not include querystring.unescape
and therefore this assignment doesn't work as expected.
Refs:
https://github.com/substack/node-browserify/issues/826
https://github.com/mike-spainhower/querystring/issues/4
https://github.com/Gozala/querystring/issues/6
I'm closing this issue as it does not appear to be caused by a bug in this library.
@andornaut did you find how to fix it on electron? i still get this error
I note that unescape is deprecated: (reference)
consequently self._qs.unescape(item) should be replaced by decodeURI(item)
Most helpful comment
I note that unescape is deprecated: (reference)
consequently self._qs.unescape(item) should be replaced by decodeURI(item)