Closed hthetiot closed 7 years ago
Hi @hthetiot
Jonathan & I found that the FormData fix did not work for both Proxied & Non proxied requests. We instead moved the serializeXhrBody() call into the if block so that it is only used for proxied requests. Do you have any concerns about that?
redefine(xhrProto, 'send', function (body) { var url = xhrInfo.get(this, 'url'); var self = this; // Also fix support for node-http2 FormData //Priov // body = serializeXhrBody(body); if (configuration.isConfiguring()) { //removed for brevity } else { var destination = parseUrl(url); var proxyTransportUrl = configuration.getTransportUrl(destination); if (proxyTransportUrl) { if (configuration.debug) { configuration._log.debug("Proxying XHR(" + url + ") via " + proxyTransportUrl); } body = serializeXhrBody(body); this._sendViaHttp2(destination, body, proxyTransportUrl); } else { if (configuration.debug) { configuration._log.debug("Sending XHR(" + url + ") via native stack"); } this._open(xhrInfo.get(this, 'method'), url, xhrInfo.get(this, 'async'), xhrInfo.get(this, 'username'), xhrInfo.get(this, 'password')); // TODO set headers this._send(body); } } });
Allow FormData to Socket.
Example:
Also fix missing headers on non proxy xhr.