martinbtt / net-http-spy

Ever wondered what HTTP requests the Ruby gem you are using to connect to a third party API is making? Use HTTP Spy to see what is going on behind the scenes
http://github.com/martinbtt/net-http-spy
196 stars 22 forks source link

Cryptic errors raised if http_logger_options are nil #7

Open RickCarlino opened 10 years ago

RickCarlino commented 10 years ago

The problem:

If you include the gem in a project and attempt to make an HTTP request without first setting Net::HTTP.http_logger_options for the current environment, a cryptic #<NoMethodError: undefined method 'info' for nil:NilClass> from lib/net-http-spy.rb:24 within Net::HTTP#initialize() is raised.

It appears that a similar issue was raised 2 years ago in issue #2 .

Work around

I fixed the issue by simply adding a config to the correct environment file. It was a pretty simple fix and was just carelessness on my part, but would it be appropriate to add a more descriptive error / initialize some sane defaults to prevent nils? If so, I would be willing to write a pull request / specs for it. Please let me know. Posting this issue up for now incase others have come across this error.

johnceh commented 10 years ago

Fixed it for me. Thanks.