flatiron/union

setEncoding is not defined

ccarollo opened this issue · 9 comments

We need this for a variety of reasons. Currently, without it using connect middleware like bodyParser.js causes incorrect parsing of the POST body.

Thanks for the heads-up! I'll try to get a fix in tonight (or possibly tomorrow).

I plan on testing this more thoroughly before closing the issue.

@ccarollo If you happen to have an example that should work sharing it would make this happen faster. :)

Hi Joshua,

Attached is the html form page and the js code that I am using.
If there is anything else that you need, let me know.

Thanks
Christian Carollo

On Tue, Nov 29, 2011 at 5:36 PM, Joshua Holbrook <
reply@reply.github.com

wrote:

I plan on testing this more thoroughly before closing the issue.

@ccarollo If you happen to have an example that should work sharing it
would make this happen faster. :)


Reply to this email directly or view it on GitHub:
#10 (comment)

@jesusabdullah Your fix looks incorrect. The .setEncoding method on http.ServerResponse is not destructive, so you can simply proxy to the underlying object

See: https://github.com/flatiron/union/blob/master/lib/response-stream.js#L37-45

This could easily be changed to

['setHeader', 'getHeader', 'removeHeader', 'setEncoding'].forEach(function (method) {
  ResponseStream.prototype[method] = function () {
    return this.response[method].apply(this.response, arguments);
  };
});

I believe the current fix is now correct, though the test bombs. I'll have to investigate further.

Per the IRC chat we had earlier today. POST params are now coming through without the need for middleware of any kind. I am currently running on 0.6.2 and Union 0.1.3 patched with gh10 fixes for issue #10.

Prior to this I had been working with 0.4.12 and an earlier version of Union and I was informed that a developer would need to stream the POST params. If this new functionality was intended then I am all for it. Just want to make sure it is going to stick around.

@jesusabdullah Is this still an issue? It's quite old.

Seeing as how accessing post bodies worked flawlessly for the gimmesomebeta app? Nope.

Does anyone know what version this got fixed in?