bblimke / webmock

Library for stubbing and setting expectations on HTTP requests in Ruby.
MIT License
3.98k stars 555 forks source link

Unix sockets in Excon #609

Open lasseebert opened 8 years ago

lasseebert commented 8 years ago

I'm using Excon to connect to a local unix socket. It seems that WebMock also handles these requests, but with som oddities:

It registers a request to GET unix:///ping as :get, http://unix/ping

I can certanly use the workaround of just matching that url instead of the correct one in my specs, but I was wondering if this is intended or a bug. Or am I just misunderstanding something? :)

Ref:

1) Client ping makes the right request
     Failure/Error: expect(WebMock).to have_requested(:get, "unix:///ping")

       The request GET http://unix///ping was expected to execute 1 time but it executed 0 times

       The following requests were made:

       GET http://unix/ping with headers {'Authorization'=>'Basic dXNlcjpwYXNz', 'Host'=>''} was made 1 time

       ============================================================
bblimke commented 8 years ago

Webmock doesn't have support for Excon unix sockets. You can use use Excon built in stubbing.

lasseebert commented 8 years ago

Ok, thx.

Would it be within the scope of WebMock to have support for Excon unix sockets via Excon built in stubbing? If I find the time, I could have a look at implementing it.

bblimke commented 8 years ago

@lasseebert unix:///ping is a valid URI therefore I don't see anything reason for not supporting it in WebMock.