ncr / rack-proxy

A request/response rewriting HTTP proxy. A Rack app.
MIT License
269 stars 94 forks source link

Allow streaming to be disabled #18

Closed wbyoung closed 11 years ago

wbyoung commented 11 years ago

I'm using this middleware in Rails to set up a proxy that allows more simplified testing of an AJAX request by sending requests to the local server. Doing so allows the request to go through ruby code & to be matched via WebMock.

Basically, something like this:

This wasn't working with the streaming http requests, so I added a way of disabling them. This change should be backwards compatible for everyone who properly called super if they overrode initialize in their own constructor. Otherwise, it will fail to use the previous streaming logic.

ncr commented 11 years ago

Thank you! I had to change the constructor: https://github.com/ncr/rack-proxy/commit/628cbc27c83666a901ecc3c893757b72369ea230, tests were failing.

wbyoung commented 11 years ago

I figured that could cause problems & put it in a separate commit for that reason. It was a little confusing to me when I started using this because it seems like the standard for Rack classes is to take an app arg (first time working with Rack middleware, though, so my confusion may not mean much). Either way, it still works fine for me. Thanks for creating this!

ncr commented 11 years ago

Great to hear you like it! I haven't used rack-proxy in a long time, I don't remember why @app is not there :)

2013/8/21 Whitney Young notifications@github.com

I figured that could cause problems & put it in a separate commit for that reason. It was a little confusing to me when I started using this because it seems like the standard for Rack classes is to take an app arg (first time working with Rack middleware, though, so my confusion may not mean much). Either way, it still works fine for me. Thanks for creating this!

— Reply to this email directly or view it on GitHubhttps://github.com/ncr/rack-proxy/pull/18#issuecomment-23043087 .

Jacek Becela

http://trix.pl http://twitter.com/jacekbecela http://github.com/ncr