chrisk/fakeweb

support setting content_type of resonse

wireframe opened this issue · 3 comments

I'd like to stub out a response to an image file and have the FakeWeb response return 'image/jpeg' as the content type.

i'd like it to work something like this:
FakeWeb.register_uri(:get, 'http://mysite.com/image.jpeg', :file => fixture_path + '/files/image.jpeg', :content_type => 'image/jpeg')

Sounds like a good idea. I've just been using a full stored response with a Content-Type header, but that's a pain when you want to return a quick json response (or use binary, like your 'image/jpeg').

Anybody have a patch w/ tests for this?

I have the patch for this. With a test. How would you like it? I could push to the repo...

OK, thanks to dmichael, this is fixed on the master branch, and should make it into the next release. Here's the commit: b8fbab4