No9 / harmon

middleware for node-http-proxy to modify the remote website response with trumpet
Other
424 stars 62 forks source link

Support writeHead overload specifying a status code message #38

Closed ArcanoxDragon closed 8 years ago

ArcanoxDragon commented 8 years ago

This allows handlers (such as node-http-proxy) being called after harmon to specify a status code message with the status code when calling "writeHead". The Node.js documentation specifies the writeHead signature as being: response.writeHead(statusCode[, statusMessage][, headers])

This commit makes harmon's writeHead patch properly handle both overloads to the response.writeHead method.

ArcanoxDragon commented 8 years ago

This is going to fail CI tests until nodejitsu/node-http-proxy#1061 is accepted unless package.json is changed to use http-proxy@~1.14. The latest version of http-proxy does not call writeHead properly, so isHtml is never set to true and Trumpet is never run.

nodejitsu/node-http-proxy#1061 specifies that it depends on this PR, so this PR will have to change package.json.

No9 commented 8 years ago

@briman0094 Thanks for creating this PR. I am time restricted at the moment so I have added you as a collaborator Please let me know your npm handle and you can push too.

ArcanoxDragon commented 8 years ago

@No9 sure; my npm username is arcanox.

No9 commented 8 years ago

@briman0094 also added you to npm too.

ArcanoxDragon commented 8 years ago

@No9 just noticed and published an update, thanks :)