Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Consider 0.0.0.0 to be a localhost alias.

Note that WebMock doesn't yet consider 0.0.0.0 to be localhost, so it doesn't fully work if you use WebMock.

Closes #15.
  • Loading branch information...
commit 6c86a96a835ac9054ec3dd943d6c476591cdc9a7 1 parent a2bdbeb
Myron Marston authored
1  CHANGELOG.md
Source Rendered
@@ -11,6 +11,7 @@
11 11 * Fixed VCR/Net::HTTP/WebMock integration so that VCR no longer loads its Net::HTTP monkey patch when
12 12 WebMock is used, and relies upon WebMock's after_request callback to record Net::HTTP instead. This
13 13 fixes [a bug](http://github.com/myronmarston/vcr/issues/14) when using WebMock and Open URI.
  14 +* Consider 0.0.0.0 to be a localhost alias (previously only "localhost" and 127.0.0.1 were considered).
14 15
15 16 ## 1.1.2 (September 9, 2010)
16 17
2  lib/vcr.rb
@@ -14,7 +14,7 @@
14 14 module VCR
15 15 extend self
16 16
17   - LOCALHOST_ALIASES = %w( localhost 127.0.0.1 )
  17 + LOCALHOST_ALIASES = %w( localhost 127.0.0.1 0.0.0.0 )
18 18
19 19 def current_cassette
20 20 cassettes.last
23 spec/fixtures/1.9.1/cassette_spec/with_localhost_requests.yml
@@ -56,6 +56,29 @@
56 56 - !ruby/struct:VCR::HTTPInteraction
57 57 :request: !ruby/struct:VCR::Request
58 58 :method: :get
  59 + :uri: http://0.0.0.0:80/
  60 + :body:
  61 + :headers:
  62 + :response: !ruby/struct:VCR::Response
  63 + :status: !ruby/struct:VCR::ResponseStatus
  64 + :code: 404
  65 + :message: Not Found
  66 + :headers:
  67 + content-type:
  68 + - text/html; charset=iso-8859-1
  69 + connection:
  70 + - close
  71 + server:
  72 + - Apache/2.2.3 (CentOS)
  73 + date:
  74 + - Thu, 25 Feb 2010 07:53:52 GMT
  75 + content-length:
  76 + - "277"
  77 + :body: 127.0.0.1 response
  78 + :http_version: "1.1"
  79 +- !ruby/struct:VCR::HTTPInteraction
  80 + :request: !ruby/struct:VCR::Request
  81 + :method: :get
59 82 :uri: http://example.com:80/
60 83 :body:
61 84 :headers:
23 spec/fixtures/not_1.9.1/cassette_spec/with_localhost_requests.yml
@@ -56,6 +56,29 @@
56 56 - !ruby/struct:VCR::HTTPInteraction
57 57 request: !ruby/struct:VCR::Request
58 58 method: :get
  59 + uri: http://0.0.0.0:80/
  60 + body:
  61 + headers:
  62 + response: !ruby/struct:VCR::Response
  63 + status: !ruby/struct:VCR::ResponseStatus
  64 + code: 404
  65 + message: Not Found
  66 + headers:
  67 + content-type:
  68 + - text/html; charset=iso-8859-1
  69 + connection:
  70 + - close
  71 + server:
  72 + - Apache/2.2.3 (CentOS)
  73 + date:
  74 + - Thu, 25 Feb 2010 07:53:52 GMT
  75 + content-length:
  76 + - "277"
  77 + body: 127.0.0.1 response
  78 + http_version: "1.1"
  79 +- !ruby/struct:VCR::HTTPInteraction
  80 + request: !ruby/struct:VCR::Request
  81 + method: :get
59 82 uri: http://example.com:80/
60 83 body:
61 84 headers:
1  spec/support/http_library_adapters.rb
@@ -206,6 +206,7 @@ def test_request_stubbed(method, url, expected)
206 206 before(:each) { subject.ignore_localhost = true }
207 207
208 208 it "allows requests to #{localhost_alias}" do
  209 + pending "Waiting for WebMock to add 0.0.0.0 as a localhost alias as well" if localhost_alias == '0.0.0.0' && subject == VCR::HttpStubbingAdapters::WebMock
209 210 get_body_string(make_http_request(:get, "http://#{localhost_alias}:#{localhost_server.port}/")).should == localhost_response
210 211 end
211 212 end

0 comments on commit 6c86a96

Please sign in to comment.
Something went wrong with that request. Please try again.