-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
can not mock successfully when using gock.EnableNetworking()
#93
Comments
gock.EnableNetworking()
You should not enable the real networking mode if the requests you are testing are not valid network reachable hosts unless you want to explicitly test that scenario. Simply ignore the |
now I have to test a
what should I do in this condition with out thanks~ |
You can enable the real networking mode per specific mock instance instead of enabling it globally: |
hi @h2non, in the example you provided, i saw this
and i have two questions:
Thanks. |
In my project , I have to use
gock.EnableNetworking()
so that the real HTTP request will be requested if the mock can not be matched.However, in this case, the url in
gock.New(...)
has to be a real url. If I use a random url such as "http://123456/bar" , an error will happened :GET http://123456/bar Get "http://123456/bar": dial tcp 0.1.226.64:80: connect: no route to host
the whole code is as follow
The text was updated successfully, but these errors were encountered: