Make webmock allow requests to webpack too
What does this MR do?
I am running webpack on gdk.test
, which I've set to 127.1.1.1
in my /etc/hosts
. It's a local loopback interface, similar to (but separate from) 127.0.0.1
. WebMock is already configured to allow connections to localhost
(which equals to 127.0.0.1
), but not outside that. So when I was running specs, I got an error from WebMock the connection was not permitted:
WebMock::NetConnectNotAllowedError:
Real HTTP connections are disabled. Unregistered request: GET http://gdk.test:3808/assets/webpack/manifest.json with headers {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Ruby'}
You can stub this request with the following snippet:
stub_request(:get, "http://gdk.test:3808/assets/webpack/manifest.json").
with(
headers: {
'Accept'=>'*/*',
'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
'User-Agent'=>'Ruby'
}).
to_return(status: 200, body: "", headers: {})
============================================================
This MR makes sure the connection is permitted.
For this to work, you'll need in your config/gitlab.yml
:
test:
webpack:
dev_server:
enabled: true
host: gdk.test
port: 3808
I'm working on a change in GDK to provide this: gitlab-development-kit!787 (merged). But if the configuration is not provided, things will remain working as before.
Edited by Toon Claes