-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request.parse / this._parser not used for browser? #1053
Comments
Neither buffering, nor response body parsing are available in the browser. These things are handled natively by XHR. In Node parser is expected to listen to events on response stream, but in the browser we don't have a stream (we could #1033) |
Ah, so makes sense that It still seems like providing a parser via Current code: // lib/client.js:375
Response.prototype._parseBody = function(str){
var parse = request.parse[this.type];
if (!parse && isJSON(this.type)) {
parse = request.parse['application/json'];
}
return parse && str && (str.length || str instanceof Object)
? parse(str)
: null;
}; What I thought I'd find based on // lib/client.js:375
Response.prototype._parseBody = function(str){
var parse = this._parser || request.parse[this.type]; // only changed this line
if (!parse && isJSON(this.type)) {
parse = request.parse['application/json'];
}
return parse && str && (str.length || str instanceof Object)
? parse(str)
: null;
}; |
v5.0.0 was released and should fix this issue, see the updated docs |
this._parser
is set inrequest-base.js
viaparse
method, but is only used inlib/node/index.js
.It seems like
_parseBody
inclient.js
should use it, but it doesn't.Is this a bug? It appears that maybe this is similar to (or a continuation of) #805?
Also noteworthy and related:
buffer(true|false)
is not available in the browser.The text was updated successfully, but these errors were encountered: